I get loads of 'Circular dependency' errors when bundling 'npm link' symlinked modules
twilson90 opened this issue · 1 comments
My project is located in C:/projects/my-project.
In there I ran npm link "C:/projects/another-project"
That allows me to import code from the other project.
But when I try using rollup on 'my-project', I get a load of errors that look like this:
Circular dependency: node_modules/core-js/modules/es.symbol.js -> C:/projects/my-project/node_modules/core-js/modules/es.symbol.constructor.js?commonjs-proxy -> node_modules/core-js/modules/es.symbol.constructor.js -> node_modules/core-js/modules/es.symbol.js
This is my script:
/**
var plugins = [];
plugins.push(
rollup_plugin_node_resolve({browser: true}),
rollup_plugin_commonjs({}),
rollup_node_polyfills(),
);
var babel_presets = [
[
"@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": "3"
},
]
];
var babel_plugins = [];
plugins.push(
rollup_plugin_babel({
"babelHelpers": "bundled",
"presets": babel_presets,
"plugins": babel_plugins,
})
);
try {
await fs.mkdir(".rollup", {recursive:true});
var options = {
preserveSymlinks: true,
input: filename,
plugins,
}
var bundle = await rollup({...options, cache});
var formats = ["iife"];
for (let f of formats) {
/** @type {import("rollup").OutputOptions} */
let output = {
"format": f,
"file": out_filename,
"name": name,
"sourcemap": false,
};
await bundle.write(output);
}
} catch (e) {
console.error(e);
}
console.log (`Rollup complete.`);
If I don't use 'preserveSymlinks' then it can't resolve all the corejs modules.
Any ideas how I can fix this?
I'd commented out "exclude": "node_modules/**"
from my babel config. Adding that back in fixed it.