New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
external files are being bundled for commonjs #4273
Comments
it is works after remove export default {
external: ["foo.js"],
input: "./index.js",
output: {
exports: 'auto',
file: "./build/bundle.js",
format: "cjs",
},
plugins: [],
} output: 'use strict';
const foo = require("./foo.js");
console.log(foo); seem need file issue to |
actually rollup provides some use case in |
thanks @FoxDaxian , you are right. now I'm entirely lost and confused. 🤔
not going to. out of principle. |
This is indeed an issue with the commonjs plugin. I added a fix to the PR rollup/plugins#1038 I am working on at the moment. May take a while until it is merged though (by the way, that one will look for more beta testers soon). |
it got a little late yesterday. I was surprised as I thought he commonjs syntax is unknown to rollup. and as it turns out, it is. this is not really working without the export default {
// external: ["foo.js"], <--- removed
input: "./index.js",
output: {
exports: 'auto',
file: "./build/bundle.js",
format: "cjs",
},
plugins: [],
} |
@dnalborczyk 'use strict';
var foo = "foo";
console.log(foo); rollup do not have |
Rollup Version
2.60.0
Operating System (or Browser)
n/a
Node Version (if applicable)
n/a
Link To Reproduction
n/a
Expected Behaviour
.
Actual Behaviour
foo.js
foo.js
rollup.config.js
bundled:
possibly a commonjs-plugin bug (also does not work with the json plugin). might ignore the
external
setting, or rollup is not passing it along. hence I'm filing it here.works when source files are
esm
.bundled:
failed attempt to cross file: rollup/plugins#1044
The text was updated successfully, but these errors were encountered: