-
-
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
babelrc with relative babel plugins are resolved incorrectly. #1698
Comments
I'm using babel plugins to slightly alter the code that parcel sees while prototyping some builds ( My workaround for this for now is to move the babel plugins into nested folders then just npm link them at the root of the repo. |
hmm it seems that babel tries to resolve plugins relative to the file being transformed rather than the We might have to resolve them ourselves prior to passing to babel? config is generated here: https://github.com/parcel-bundler/parcel/blob/master/src/transforms/babel.js |
Hi, this is also impacting local babel preset paths.
package.json
|
So the same issue seems to happens when extending configs.
.babelrc
Presets inside the external config seems applied (React, Flow), but not plugins. |
Easy workaround for this in
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
🐛 bug report
Parcel builds fail when
.babelrc
files contain relative paths plugins.🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
The path to the
babel-plugin.js
should be resolved relative to the babelrc.😯 Current Behavior
Parcel is attempting to resolve
babel-plugin.js
from the files that it is transforming.It creates and error like this:
💁 Possible Solution
I looked at this very briefly, looks like Parcel is just creating a new
File
frombabel-core
and babel-core is doing the resolving, but is passingbabelrc: false
https://github.com/parcel-bundler/parcel/blob/master/src/assets/JSAsset.js#L74
In my mind since the config is coming from babelrc, that should be true, but I'm guessing Parcel is adding additional plugins and that's why it's passing false.
Another potential solution to this would be to resolve the plugins before passing to babel-core.
🔦 Context
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: