Babel-loader: babelrc: false still reads .babelrc file

Created on 14 Mar 2017  路  11Comments  路  Source: babel/babel-loader

I'm submitting a bug report

Webpack Version:
2.2.1

Babel Core Version:
~5.24.0~
6.24.0

Babel Loader Version:
6.4.0

Please tell us about your environment:
maxOS 10.12.3

Current behavior:
When using babelrc: false, babel-loader still reads from babelrc file

Expected/desired behavior:
Should not read from babelrc file

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
    https://gist.github.com/hulkish/5d225beda0fc6cc1c1332befc00f0edf

  • What is the expected behavior?
    (per the example) react-hot-loader/babel should not be included in bundle. However, it indeed does show up.

  • What is the motivation / use case for changing the behavior?
    babelrc: false should completely ignore all .babelrc files

Most helpful comment

@hulkish I'm having same issue. I'm having similar webpack config file and want to skip babelrc and rather use the config set in webpack file.

module: {
  loaders: [
    {
      test: /\.js$/,
      loader: 'babel-loader',
      include: path.join(__dirname, 'app'),
      options: {
        babelrc: false,
        presets: ['react', 'es2015', 'stage-0'],
        plugins: ['babel-plugin-transform-decorators-legacy']
      }
    },
    {
      test: /\.css$/,
      loaders: ['style-loader','css-loader','postcss-loader']
    },
    {
      include: /\.json$/,
      loaders: ["json-loader"]
    }
  ]
},

All 11 comments

anyone else seeing this?

I think that option may not work on babel-loader for Babel 5.

@loganfsmyth I corrected my typo, thanks for pointing out - I'm actually using [email protected]. To be clear - this is still an issue for me.

You'll want to make sure both babel-core and babel-loader are up to date.

@loganfsmyth I'm using the latest for both.

I wonder... could it be that I'm using options instead of query? Isn't it options for webpack 2? Ex: https://gist.github.com/hulkish/5d225beda0fc6cc1c1332befc00f0edf#file-webpack-config-js

Have you verified that if you comment out the line in the .babelrc you don't see any of your code you're seeing in there? Maybe it is getting in there some other way?

What could cause babel-loader to ignore my babelrc: false?

ive determined this is related to my configHash function being too narrow in scope. Go ahead and close this issue.

@hulkish I'm having same issue. I'm having similar webpack config file and want to skip babelrc and rather use the config set in webpack file.

module: {
  loaders: [
    {
      test: /\.js$/,
      loader: 'babel-loader',
      include: path.join(__dirname, 'app'),
      options: {
        babelrc: false,
        presets: ['react', 'es2015', 'stage-0'],
        plugins: ['babel-plugin-transform-decorators-legacy']
      }
    },
    {
      test: /\.css$/,
      loaders: ['style-loader','css-loader','postcss-loader']
    },
    {
      include: /\.json$/,
      loaders: ["json-loader"]
    }
  ]
},

yep, same error. i try to use skpm, the default config is like that:

"use": {
  "loader": "babel-loader",
  "options": {
    "babelrc": false,
    "presets": []
  }
}

but when i put .baberc in root, it still read.

It would be best to create a reproducible example repository and file a new issue.

Was this page helpful?
0 / 5 - 0 ratings