Skip to content

Conversation

@peterhpchen
Copy link

Problem

@babel/plugin-transform-modules-commonjs used by @babel/preset-env
for transform modules to commonjs will save which nodes have already traverse and skip them when the next traverse(https://github.com/babel/babel/blob/10978bb65a4b4e8874ca8dd3054b8c31b5838b7f/packages/babel-helper-module-transforms/src/rewrite-live-references.js#L175)

@babel/plugin-transform-modules-commonjs will save every traversed reference of node, so if the references of node are same, the babel will skip to transform the node. This is the problem of this issue.

Resolve

Just clone object to prevent use same object reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant