-
-
Notifications
You must be signed in to change notification settings - Fork 448
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.js is being ignored #780
Comments
If it's not loading, it's probably got something to do with your working directory, package scope, and the |
Thank you for replying @loganfsmyth, I have updated my report with additional information, hope that clears things up |
I have the same issue in a monorepo where my const babelConfig = require('./.babelrc');
module.exports = {
...
module: {
rules: [
{
test: /\.jsx?/,
exclude: /\/node_modules\//,
loader: 'babel-loader',
options: babelConfig // <--- Here :)
},
...
]
},
...
}; |
@hampustagerud this doesn't work when the subpackages have their own alias configuration using |
I use What does your webpack config look like? I didn't write it before but I imported my |
@hampustagerud That's exactly why it is working for you I guess. I have subpackages with the same alias pointing to a different folder (see my example - they all have Not sure whether this is a |
I had it working fine when using Got the same version: |
@ykadosh I am having the exact same issue as you, with the same setup. Did you ever figure anything out? |
The .js extension seems redundant. Try to rename it var path = require('path');
module.exports = {
mode: 'production',
entry: './src/components/index.js',
output: {
path: path.resolve('build'),
filename: 'index.js',
libraryTarget: 'commonjs2'
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: 'babel-loader'
}
]
},
externals: { // this line is just to use the React dependency of our parent-testing-project instead of using our own React.
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
umd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
umd: 'react-dom'
}
}
} This is my .babelrc
Make sure you do
You will get a warning saying that babel-loader version is 7, but babel core is version 6. The npm logs suggests to use a .env file at the root with the following line
Full repo is here |
I'm submitting a bug report
Webpack Version:
4.29.6
Babel Core Version:
7.4.0
Babel Loader Version:
8.0.5
Please tell us about your environment:
Windows 10
Current behavior:
.babelrc.js
files are being ignoredExpected/desired behavior:
.babelrc.js
files are NOT being ignored :)Additional Info
The project is a monorepo, where the root package (i.e.
bundler
) is placed as a sibling to the other subpackages (i.e.module1
).Both the root package and the subpackage have the same alias -
components
, but it points to a different path in each. However, apparently themodule1
babelrc is being ignored, since babel is searching in thebundler
package for modules that are inmodule1
.project/bundler/babel.config.js
project/module1/.babelrc.js
The build fails with the following error:
The text was updated successfully, but these errors were encountered: