-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
optimize: Simplify the export-default-from
transform
#14768
Conversation
@@ -1,3 +1,2 @@ | |||
import _v from "mod"; | |||
export { _v as v }; | |||
export { default as v } from "mod"; | |||
export { x, y as w } from "mod"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further optimization idea: we can merge { default as v }
with the next specifier if exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. And here come a case
export v, * as ns, { x, y as w } from "mod";
if there is a namespace compound, should we merge it?
// a.js
export { default as v, x, y as w} from "mod";
export * as ns from "mod";
The export order will change.
import * as ns from "a.js";
Object.keys(ns) // order changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it will be merged if there is no namespace export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
See the test cases