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
Rollup v0.56.5 breaks bundles where there are two (or more) classes defined with the same name #2047
Comments
Thanks for posting, it seems this is an edge case of #2025 where for some mysterious reason the JS spec has decided that the class name itself exists supersedes in the super expression scope even if it is a class expression. The fix here will likely be to explicitly check if the class name itself is used as a non-deshadowed binding in the super expression and then to skip this renaming trick in that case! //cc @NaridaL |
I guess we will need to find a way to mark the class id as used when deshadowing variables. |
Ahh, right that is definitely a problem then as these deshadowing cases all effectively invalidate the optimization. I think we should revert #2025 then at least until a new approach can be found. |
…pression names remove unnecessary underscore suffix and the corresponding TODO comments, because the rollup bug was fixed: github.com/rollup/rollup/issues/2047
…pression names (#34757) remove unnecessary underscore suffix and the corresponding TODO comments, because the rollup bug was fixed: github.com/rollup/rollup/issues/2047 PR Close #34757
…pression names (#34757) remove unnecessary underscore suffix and the corresponding TODO comments, because the rollup bug was fixed: github.com/rollup/rollup/issues/2047 PR Close #34757
Please refer to the repro here: https://github.com/ilmiont/rollup-v0.56.5-test
The
repro-v0.56.4.js
was compiled in Rollup v0.56.4 and runs fine in current browsers (Chrome latest, Firefox latest).The
repro-v0.56.5.js
was compiled from the same source in Rollup v0.56.5, and does not run in browsers, as it throws anUncaught ReferenceError: Model is not defined
.This is caused by the change in Rollup v0.56.5 due to #2025 which creates the following in the bundle:
Maybe it seems like an edge case that there are two classes with the same name (as written) in the project, but I really don't think it is. In my scenario, I've got an ecosystem of libraries with components that extend each other to add additional functionality.
The end result is, that in an app I'm working on, a search for "class Model" or "class Controller" definitions in the unbundled source will result in several matches, which wasn't an issue in Rollup v0.56.4 because it would just append
$x
to the end of each class name (wherex
is obviously an integer incremented for each new class definition of this name).The new syntax in Rollup v0.56.5 means builds of this app are currently completely broken, and I don't think there's a way to mitigate this without me renaming all my classes. Sticking with Rollup v0.56.4 for now until this behaviour is confirmed.
The text was updated successfully, but these errors were encountered: