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
Uncaught SyntaxError: Identifier '_$1' has already been declared #2726
Comments
Hello @ashubham, this looks like a serious issue but without the actual code, I fear we will have a hard time tracking it down as we need to rely solely on guesswork. If you can reduce it to a small example exposing the error, this would be awesome, but any reproduction will do. |
Note also that there is not identifier |
Sorry for the incomplete info: The list of plugins:
We have a large codebase, I am not sure of a small enough reproducible sample, but let me try. |
I see. So if I understand you correctly, the error prevents you from bundling your code at all (instead of your bundled code throwing a runtime error)? If that is the case, then somewhere in the codebase (rollup itself or plugins, but I already checked rollup) there is an identifier Beyond that it sounds strange that a rollup update alone would cause this error. Were other plugins updated as well? When you downgrade just Rollup, what is the first exact version that exposes the error? If it turns out to be one of the plugins, the same question would apply. |
@lukastaegert No actually the bundled code throws the above error, when run in the browser.
I have not done a binary search for the breaking version, but can do if you need me to. |
I feared as much. Unfortunately version 1.2 contained a complete rewrite of the deconflicting logic so the version alone will not help too much in pinpointing what we overlooked. If you do not manage to produce a repro maybe someone else will stumble upon the same bug. I will also have another look if I can think of a scenario that I have overlooked once I find some time but no promises here. |
Just a question, is this a single chunk build or does it involve multiple chunks? |
I must admit I spent some time looking for potential holes in the deconflicting but cannot find any. If you cannot provide a complete reproduction, maybe you can provide a snippet of the generated code around the duplicate declarations of It would be very helpful to know:
|
See duplicate If we look at the chunk referenced above we see lodash is being exported twice on two different namespaces: look for
I tried manually removing the rogue 2nd duplicate import. But then it complained about another duplicate name, so it seems there are multiple of these. FWIW, the problem goes away if I do |
Thanks a lot! In fact this looks very similar to an issue we fixed in 1.3.2, could you try again with that version? If it is the same issue, then you will still have the double exports (there is a technical reason for that that is not so easy to solve) but the second import will be omitted, fixing the syntax error. |
Actually, the above issue is hit with using rollup |
Ok, would be nice if you could
and see if this Rollup version fixes your problem. |
How Do We Reproduce?
Simple config, which worked with version 1.1.2
Expected Behavior
Should create a bundle, which runs in the browser
Actual Behavior
Console error
Uncaught SyntaxError: Identifier '_$1' has already been declared
The text was updated successfully, but these errors were encountered: