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
Handle export enum
incorrectly
#4291
Comments
BTW, any other conditions result to the error bundle like above? |
I've been having the same issue recently and it's quite annoying as I cannot seem to find a way to make it not happen. |
I assume that |
Actually it happens with |
https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBMAdgVwLZwCrAM7wN4CwAUHHIgIarDEC+QA export var Test;
(function (Test) {
Test[Test["name"] = 0] = "name";
})(Test || (Test = {})); you should rather use Objects as enums or union types instead. enum is not (yet) part of ecmascript, but there's hope: https://github.com/Jack-Works/proposal-enum |
Why this generated |
Following is the expected interation behavior between rollup and plugins:
var Button = function Button() {
console.log('Button');
};
var Test;
(function (Test) {
Test[Test["name"] = 0] = "name";
})(Test || (Test = {}));
export { Button, Test };
|
@dnalborczyk what I missed🤕 , please give me some helps, thx~ |
@lukastaegert could you shed some light on this? |
For performance reasons, when checking functions for side effects, they do not try out (yet) all possible parameter values they are called with, they just assume the worst, which is usually all parameters being Improving here is something I wanted to do for a long time, but it is some very delicate mechanics with lots of things to consider, and there are more important bugs I need to work on at the moment. The usual "fix" for these kinds of TypeScript issues is using |
Thanks for your answer, I'll take a try later. |
Ah sorry, it would be |
@lukastaegert It's be ok, thanks for your answer again. I'd keep dive into it |
@NotZoeyDev the advice from me is not to use
|
Rollup Version
2.60.2
Operating System (or Browser)
macOS Monterey
Node Version (if applicable)
16.13.0
Link To Reproduction
https://github.com/wqcstrong/export-name-from-module
Expected Behaviour
Don't import the unused module in the bundle and its behavior is like the module produce some side effect.
Actual Behaviour
import the unused module because
export enum
in the moduleThe text was updated successfully, but these errors were encountered: