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
Overlapping class names #4753
Labels
Comments
This was part of an optimization to keep the internal name of the class. I will see how I can fix this. |
9 tasks
Turns out that while there was a logic in place to avoid such conflicts, it ignored classes defined in default exports. Fixed in #4756 |
Thank you so much, that`s so great |
lukastaegert
added a commit
that referenced
this issue
Dec 17, 2022
This issue has been resolved via #4756 as part of rollup@3.7.5. You can test it via |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rollup Version
3.7.4
Operating System (or Browser)
firefox
Node Version (if applicable)
No response
Link To Reproduction
https://rollupjs.org/repl/?version=3.7.4&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMEJhciUyMGZyb20lMjAlNUMlMjIuJTJGZm9vJTVDJTIyJTVDbiU1Q25jb25zdCUyMHdyYXBwZXIlMjAlM0QlMjAoKSUyMCUzRCUzRSUyMCU3QiU1Q24lMjAlMjBjbGFzcyUyMEZvbyUyMGV4dGVuZHMlMjBCYXIlN0IlN0QlNUNuJTVDbiUyMCUyMHJldHVybiUyMEZvbyU1Q24lN0QlNUNuJTVDbmNvbnNvbGUubG9nKHdyYXBwZXIoKSklNUNuJTVDbiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMmZvby5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjBkZWZhdWx0JTIwY2xhc3MlMjBGb28lMjAlN0IlN0QlMjIlMkMlMjJpc0VudHJ5JTIyJTNBZmFsc2UlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==
Expected Behaviour
When several classes with the same name exist, the classname should be made unique.
class Foo$1 extends Foo{}
Same as in version 2.79.1 https://rollupjs.org/repl/?version=2.79.1&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMEJhciUyMGZyb20lMjAlNUMlMjIuJTJGZm9vJTVDJTIyJTVDbiU1Q25jb25zdCUyMHdyYXBwZXIlMjAlM0QlMjAoKSUyMCUzRCUzRSUyMCU3QiU1Q24lMjAlMjBjbGFzcyUyMEZvbyUyMGV4dGVuZHMlMjBCYXIlN0IlN0QlNUNuJTVDbiUyMCUyMHJldHVybiUyMEZvbyU1Q24lN0QlNUNuJTVDbmNvbnNvbGUubG9nKHdyYXBwZXIoKSklNUNuJTVDbiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMmZvby5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjBkZWZhdWx0JTIwY2xhc3MlMjBGb28lMjAlN0IlN0QlMjIlMkMlMjJpc0VudHJ5JTIyJTNBZmFsc2UlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==
Actual Behaviour
let Foo$1 = class Foo extends Foo{};
The class-name collides with the name of the sub class and and an exception is thrown
Uncaught ReferenceError: can't access lexical declaration 'Foo' before initialization
And also to use a class expression is unnecessarily long.
Further information
The regression got introduced by Version 3.2.1 https://github.com/rollup/rollup/blob/master/CHANGELOG.md#321
The text was updated successfully, but these errors were encountered: