-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Can't bundle React v0.16.0 with Rollup #1655
Comments
There is not react 0.15 and 0.16. They are major 15.0.0 and 16.0.0 |
Specifically, the problem appears to be that the input CommonJS module that Rollup is trying to transpile includes a number of variables with the $-number suffix such as |
Okay. Reduced test case here: https://github.com/mbostock/rollup-1655 This appears to be a bug in rollup-plugin-commonjs. Here’s index.js: import "./common-entry"; And common-entry.js, a CommonJS module: (function() {
var foo = require('./common-foo');
var require$$0 = "FAIL"; // COMMENT THIS LINE TO SUCCEED.
console.log(foo);
})(); And lastly common-foo.js, another CommonJS module: module.exports = "bar"; If you comment out the |
It seems like rollup-plugin-commonjs doesn’t check that the requireid does not already exist in scope; it only checks against the requireid’s it has allocated internally. |
This issue in rollup-plugin-commonjs is reporting the same issue - closing in favor of it: rollup/rollup-plugin-commonjs#232 |
All-in-one-ready-to-go testcase here: https://github.com/tmcw/rollup-react-repro
With input:
And config:
Rollup produces an incorrect bundle and fails on this error:
This error does not exist with React v0.15 - it's new in 0.16.
The core bug, which is quite a head-scratcher is:
This is, confusingly, the block that binds
require$$0
. The secondvar
gets hoisted, soobjectAssign$1
is assigned to the valueundefined
.The text was updated successfully, but these errors were encountered: