react-dnd: Babel error -Using removed Babel 5 option

I am a babel newbie, I setup a new project, installed babel, installed react-dnd via bower and my .babelrc has the following line { "presets": ["es2015", "stage-0", "react"] } Module build failed: ReferenceError:

[BABEL] <path>\bower_components\react-dnd\src\index.js: Using removed Babel 5 option: <path>\bower_components\react-dnd\.babelrc.stage - Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets

What am i doing wrong

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 16 (2 by maintainers)

Most upvoted comments

@walter0331

loader: ‘babe-loader’

This should be a thing.

Ahhh, I fixed it by excludingnode_modulesin webpack.conf 👯

      {
        exclude: /(node_modules|bower_components)/,
        test: /\.js$/,
        loader: 'babe-loader'
      },

Just to clarify, I think everyone means “babel-loader” rather than “babe-loader”.

loader: 'babel-loader'

@ry928330 basically, the disposables lib is used in react-dnd, and disposables uses an outdated babel version, Babel 5 (this library isn’t maintained). If included in the webpack configuration, it creates a conflict because we are now on the version 6 of Babel. So the better solution here ( at least what worked for me), is not necessarily to exclude all node_modules, but only the conflicting one.

add exclude: /(disposables)/ in your babel-loader webpack config, for instance:

{
     test: /\.js$/,
     exclude: /(disposables)/,
     loader: 'babel-loader',
}

I fixed by add [] presets: [ ["es2015", { loose: false }] ]