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
Class names are mangled, breaking runtime behavior that relies on them. #4637
Comments
We might be able to address this by rewriting |
I think that should work - I just tried making a very simple and naive transform plugin that does that (regardless of name or if it will be changed, since of course before chunking I can't know if it needs it or not) and it seems to work. |
Then we should implement that in core, but not sure when I will get to it. |
Hey there! If you can give me a hint on where to look to fix this, it would be nice! |
First thing you can do is write a failing test. I would recommend looking into the The reproduction above may be slightly too involved for a test, but all you need is to cause a name conflict. The easiest way to achieve this is to have two modules in your bundle that use the same top-level variables. Then to actually fix things, you need to adjust |
OK, I'll be honest. Thanks anyway for trying to explain to me 👍🏻 I can't wait to see the PR to understand what I should have done |
No problem 😉 |
Here you go, fix at #4674 |
Nice! Thank you for two things: making this fix this quick and making me learn something 😃 |
This issue has been resolved via #4674 as part of rollup@3.2.1. You can test it via |
Rollup Version
2.79.0
Operating System (or Browser)
Any
Node Version (if applicable)
NA
Link To Reproduction
https://rollupjs.org/repl/?version=2.79.0&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMFBhcmVudENvbXBvbmVudCUyMGZyb20lMjAnLiUyRnBhcmVudC1jb21wb25lbnQuanMnJTNCJTVDbm5ldyUyMFBhcmVudENvbXBvbmVudCgpJTNCJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlN0QlMkMlN0IlMjJuYW1lJTIyJTNBJTIycGFyZW50LXNjcmlwdC5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjJpbXBvcnQlMjBDaGlsZENvbXBvbmVudCUyMGZyb20lMjAlNUMlMjIuJTJGY2hpbGQtY29tcG9uZW50LmpzJTVDJTIyJTNCJTVDbmxldCUyMFBhcmVudENvbXBvbmVudC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dEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTJDJTIybmFtZSUyMiUzQSUyMm15QnVuZGxlJTIyJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=
Expected Behaviour
The resulting output, when executed, prints:
Actual Behaviour
The resulting output, when executed, prints:
because the class's names are not preserved.
This repro is a very stripped down example of the output from the Vue component compiler. The real world scenario here is using
vue-class-component
, which uses the class name as the component name.This scenario even follows this workaround, but it does not help.
Other related issues:
The text was updated successfully, but these errors were encountered: