-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
0.14.8 to 0.14.10 possibly introduced regression with named exports #1903
Comments
I can't reproduce this. Here's what I tried:
|
I'm sorry, I gave you bad information. I thought I was working with a class and taking a second look, it's an Enum in Typescript. This should reproduce what I am seeing: // a.ts
enum MySpecificEnum {
Value = 1,
}
export {
MySpecificEnum as MyEnum,
} // b.ts
import * as A from './a';
// Works
// console.log(A.MyEnum);
// Doesn't Work
console.log(A.MyEnum.Value); ./node_modules/.bin/esbuild --bundle b.ts | node // Build output from `console.log(A.MyEnum);`
(() => {
// a.ts
var MySpecificEnum = /* @__PURE__ */ ((MySpecificEnum2) => {
MySpecificEnum2[MySpecificEnum2["Value"] = 1] = "Value";
return MySpecificEnum2;
})(MySpecificEnum || {});
// b.ts
console.log(MySpecificEnum);
})(); vs. // Build output from `console.log(A.MyEnum.Value);`
(() => {
// b.ts
console.log(MySpecificEnum.Value);
})(); ➜ repro ./node_modules/.bin/esbuild --bundle b.ts | node
[stdin]:3
console.log(MySpecificEnum.Value);
^
ReferenceError: MySpecificEnum is not defined
at [stdin]:3:15
at [stdin]:4:3
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:305:38)
at node:internal/process/execution:75:19
at [stdin]-wrapper:6:22
at evalScript (node:internal/process/execution:74:60)
at node:internal/main/eval_stdin:29:5
at Socket.<anonymous> (node:internal/process/execution:206:5)
at Socket.emit (node:events:402:35) |
Thanks. Looks like this is a bug with the new enum inlining behavior. The export enum MyEnum {
Value = 1,
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module A
Module B
Build / Runtime Error
The above compiles and runs in
0.14.8
but it outputs an error after upgrading to0.14.10
that references the original class instead of the named export.The text was updated successfully, but these errors were encountered: