Skip to content
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

2.17 breaks bundle using @rollup/plugin-commonjs #3642

Closed
dstaley opened this issue Jun 18, 2020 · 2 comments · Fixed by #3643
Closed

2.17 breaks bundle using @rollup/plugin-commonjs #3642

dstaley opened this issue Jun 18, 2020 · 2 comments · Fixed by #3643

Comments

@dstaley
Copy link

dstaley commented Jun 18, 2020

Expected Behavior

The generated bundle either includes commonjsHelpers or does not reference it.

Actual Behavior

The generated bundle references a non-existing variable named commonjsHelpers. You can see the output on line 428 of output.js in the REPL. It's also produced below:

var freeGlobal =
  typeof commonjsGlobal == "object" &&
  commonjsGlobal &&
  commonjsHelpers.commonjsGlobal.Object === Object &&
  commonjsGlobal;

In v2.16.1, the same line is as follows:

var freeGlobal =
  typeof commonjsGlobal == "object" &&
  commonjsGlobal &&
  commonjsGlobal.Object === Object &&
  commonjsGlobal;

commonjsHelpers is only referenced once in the bundle, so I'm fairly sure it's not being included. Since this works with the latest version of @rollup/plugin-commonjs on v2.16.1 but not on v2.17.0, I'm unsure of whether this is an issue that needs to be solved in rollup or in the plugin, so please feel free to move this issue if everything is working as intended in rollup.

Also, just as a note, this prevents the entire bundle from working correctly, so it's preventing us from updating to v2.17.

For reference, this is the line from lodash that's being messed up.

AndreyBelym added a commit to DevExpress/testcafe that referenced this issue Jun 18, 2020
@lukastaegert
Copy link
Member

I'm looking into this, here is a minimal reproduction without the CJS plugin or lodash:
https://rollupjs.org/repl/?version=2.17.0&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMColMjBhcyUyMGhlbHBlcnMlMjBmcm9tJTIwJy4lMkZoZWxwZXJzLmpzJyUzQiU1Q25jb25zb2xlLmxvZyhoZWx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MjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==

Fix should be upcoming.

@lukastaegert
Copy link
Member

Fix at #3643, sorry for the regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants