Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Fix: babel-preset-latest → babel-preset-env
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed May 10, 2017
1 parent 14f9de9 commit 588b816
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 33 deletions.
50 changes: 18 additions & 32 deletions config/babel-preset-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,7 @@

const browsers = require('./browsers');

module.exports = function(env) {
const plugins = [
// class { handleClick = () => { } }
require.resolve('babel-plugin-transform-class-properties'),

// The following two plugins use Object.assign directly, instead of Babel's
// extends helper. Note that this assumes `Object.assign` is available.
// { ...todo, completed: true }
[require.resolve('babel-plugin-transform-object-rest-spread'), {
useBuiltIns: true,
}],

// Transforms JSX
[require.resolve('babel-plugin-transform-react-jsx'), {
useBuiltIns: true,
pragma: 'h',
}],
];

if (env === 'production') {
return {
presets: [
// Latest stable ECMAScript features
// Disable ES6 Modules transpilation since Webpack supports them natively
[require.resolve('babel-preset-latest'), {
modules: false,
}],
],
plugins,
};
}
module.exports = function() {
return {
presets: [
// ES features necessary for user’s browsers
Expand All @@ -44,6 +14,22 @@ module.exports = function(env) {
modules: false,
}],
],
plugins,
plugins: [
// class { handleClick = () => { } }
require.resolve('babel-plugin-transform-class-properties'),

// The following two plugins use Object.assign directly, instead of Babel's
// extends helper. Note that this assumes `Object.assign` is available.
// { ...todo, completed: true }
[require.resolve('babel-plugin-transform-object-rest-spread'), {
useBuiltIns: true,
}],

// Transforms JSX
[require.resolve('babel-plugin-transform-react-jsx'), {
useBuiltIns: true,
pragma: 'h',
}],
],
};
};
2 changes: 1 addition & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = function(scripts, env, options) {
ignoreOrder: true,
}),
new webpack.DefinePlugin({
'DEBUG': JSON.stringify(isDev),
DEBUG: JSON.stringify(isDev),
'process.env': {
NODE_ENV: JSON.stringify(env),
},
Expand Down

0 comments on commit 588b816

Please sign in to comment.