optimize: Simplify the export-default-from transform#14768
Merged
JLHwung merged 2 commits intobabel:mainfrom Jul 19, 2022
magic-akari:proposal/export-default-from
Merged
optimize: Simplify the export-default-from transform#14768JLHwung merged 2 commits intobabel:mainfrom magic-akari:proposal/export-default-from
export-default-from transform#14768JLHwung merged 2 commits intobabel:mainfrom
magic-akari:proposal/export-default-from
Conversation
JLHwung
approved these changes
Jul 19, 2022
| import _v from "mod"; | ||
| export { _v as v }; | ||
| export { default as v } from "mod"; | ||
| export { x, y as w } from "mod"; |
Contributor
There was a problem hiding this comment.
Further optimization idea: we can merge { default as v } with the next specifier if exists.
Contributor
Author
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
Ok, it will be merged if there is no namespace export.
existentialism
approved these changes
Jul 19, 2022
liuxingbaoyu
approved these changes
Jul 19, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the test cases