Closed garylin closed 6 years ago
Hi, I ran into an issue where my "process" global variable is conflicting with the auto generated module name if one of the dependent file has the filename of process.js. Here is the example config & sources to reproduce the problem:
// rollup.config.js import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; export default { input: 'test.js', output: { file: 'bundle.js', format: 'cjs' }, plugins: [ resolve(), commonjs(), ] }
And here are two files I try to rollup:
// test.js var p = require('./process.js') p();
// process.js function foo() { console.log(process.pid) } module.exports = foo;
In the generate bundle, the process.js gets converted to:
.... var process = __commonjs(function (module) { function foo() { console.log(process.pid); } module.exports = foo; }); ....
In the generated file, "process" used to retrieve the pid end up to become the "process" common js module. Any one know how to workaround this issue?
Hi, I ran into an issue where my "process" global variable is conflicting with the auto generated module name if one of the dependent file has the filename of process.js. Here is the example config & sources to reproduce the problem:
And here are two files I try to rollup:
In the generate bundle, the process.js gets converted to:
In the generated file, "process" used to retrieve the pid end up to become the "process" common js module. Any one know how to workaround this issue?