How to specify rollup.js to execute a given module, and return the result of the execution at build-time ?
Webpack have the val-loader
{
test: require.resolve("src/createConfig.js"),
use: [
{
loader: "val-loader",
options: {params: "my params"},
},
],
},
E.g. I have the function in createConfig.js:
export function createConfig(params) {
var config = {}
// dynamically build config from static params, quite verbose code (browse plugins array)
return config;
};
Then in main.js
import createConfig from "createConfig.js";
console.log(createConfig); // this shows not a function but object