Skip to content

Commit

Permalink
Use babel-presets by default
Browse files Browse the repository at this point in the history
This change makes it so the user doesn't need to specify their plugins.
If they want to override it they would need to modify the js loader
config using the modifyWebpackConfig API. Ideally we would support a
user provided .babelrc as well.

```
exports.modifyWebpackConfig = function(config, env) {
  config.removeLader('js')
  config.loader('js', {
    test: /\.jsx?$/,
    exclude: /node_modules/,
    loader: 'babel',
    query: {
      presets: [
        'babel-preset-react',
        'babel-preset-es2015',
        'babel-preset-stage-0',
      ].map(require.resolve),
      plugins: [
        'babel-plugin-add-module-exports',
        'babel-plugin-transform-decorators-legacy',
      ].map(require.resolve),
    },
  })
  return config;
}
```

Fixes gatsbyjs#235. Requires less user package.json dependencies unless the user
wants to add babel plugins (Users no longer need to provide
babel-plugins of any kind in their project as gatsby provides them)
  • Loading branch information
benstepp committed May 7, 2016
1 parent 17df421 commit 17e36fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ module.exports = (program, directory, stage, webpackPort = 1500, routes = []) =>
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
plugins: ['add-module-exports'],
presets: [
'babel-preset-react',
'babel-preset-es2015',
'babel-preset-stage-0',
].map(require.resolve),
plugins: [
'babel-plugin-add-module-exports',
].map(require.resolve),
},
})
config.loader('coffee', {
Expand Down

0 comments on commit 17e36fd

Please sign in to comment.