-
-
Notifications
You must be signed in to change notification settings - Fork 449
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 or config package.json is not considered #624
Comments
I'm affected by this issue, too. However, it was appearing with beta.2 in my case. The workaround you posted fixes it for me, however I would like to debug this more - if anybody can tell me where the configuration is loaded? |
Only using the new api with babel.config.js also fix this problem for me. |
Still seeing this problem with diff --git a/webpack.config.js b/webpack.config.js
index d8535a8..43d7a84 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,11 +1,23 @@
+const fs = require('fs')
+const path = require('path')
+
module.exports = {
module: {
rules: [{
exclude: /node_modules/,
loader: 'babel-loader',
- options: {
- cacheDirectory: true
- },
+ /**
+ * babel-loader doesn't load the .babelrc
+ * @todo Remove once the issue is addressed
+ * {@link https://github.com/babel/babel-loader/issues/624}
+ */
+ options: Object.assign(
+ {
+ babelrc: false,
+ cacheDirectory: true
+ },
+ JSON.parse(fs.readFileSync(path.join(__dirname, '.babelrc'), 'utf-8'))
+ ),
test: /\.js$/
}, {
exclude: /node_modules/, |
I have a similar problem. Not sure if that's intentional or not.
UPDATE: Our solution was to migrate from |
I'm affected by this too after trying to upgrade everything to v7. I think that this is only happening when transpiling Could it be that because these files are in node_modules, the config search "stops" at the package.json of the dependency, instead of traversing up? Or maybe looking in parent directories is broken in general? |
For those having issues here, I'd recommend that you read over http://babeljs.io/docs/en/config-files#file-relative-configuration It is most likely the limitations on how |
also take a look at this: |
I've read that, but I don't understand what changed here between v7 -> v8? |
@felixfbecker The differences between Babel 6 and Babel 7 in http://babeljs.io/docs/en/config-files#6x-vs-7x-babelrc-loading should help a bit. If compilation of |
So it matter whether the config file is a JS file or a JSON file? I prefer JSON because it can get autocompletion and validation against JSON schema |
No, the important differentiation is that EDIT by @nicolo-ribaudo |
I'm submitting a bug report
Webpack Version:
4.9.1
Babel Core Version:
7.0.0-beta.49
Babel Loader Version:
8.0.0-beta.3
Please tell us about your environment:
Windows 10
Current behavior:
babel-loader doesn't include config options from ".babelrc" or "package.json
Expected/desired behavior:
babel-loader uses ".babelrc" or "package.jso"
webpack:
workaround:
Before I configured babel trough "package.json". I just regonized this issue because I disabled comments in babel and found comments in my output.
The text was updated successfully, but these errors were encountered: