-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Transforming node:builtin to built-in when targeting commonjs #8049
Comments
Another place where
|
Where is the code that handles this? |
The resolver is in https://github.com/parcel-bundler/parcel/blob/v2/packages/utils/node-resolver-core/src/NodeResolver.js, search for But I think there's currently no way for a resolver to say "don't bundle this dependency (so |
Which option specifies that the target is commonjs? This line should be replaced with something like: filename = ifTargetCommonjs ? builtin.replace(/^node:/, "") : builtin;
|
Found a workaround using Babel using babel.config.json {
"plugins": ["@upleveled/babel-plugin-remove-node-prefix"],
"sourceMap": "inline"
} |
This command can be run after Parcel build: cross-env NODE_ENV=production babel ./dist/ --out-dir ./dist --source-maps true --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc Unfortunately, Parcel doesn't run babel on the dependencies. I have to use something like that |
I noticed that this also doesn't work when targeting the browser. I expect Parcel use the web polyfil for such dependencies, but it instead errors out. |
I think it is not fixed |
Could you integrate this babel transform into Parcel as the last step? |
So this is causing problems on Node <14.18.0 and Node 12? |
Yes, all the old Node versions have this issue. |
Not fixed |
🙋 feature request
Currently, Parceljs silently uses
node:builtin
inside commonjs although this doesn't work. There should be a transformer that converts this to normal nodejs imports when targeting commonjs.🤔 Expected Behavior
😯 Current Behavior
💁 Possible Solution
🔦 Context
💻 Examples
The text was updated successfully, but these errors were encountered: