Skip to content
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

fix: transform commonjs #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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