Created
September 21, 2018 15:05
-
-
Save gcangussu/a8a9c39bffd455c535630c8f1052f99e to your computer and use it in GitHub Desktop.
Babel config for front end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isProduction = process.env.NODE_ENV === 'production'; | |
const isTest = process.env.NODE_ENV === 'test'; | |
module.exports = { | |
presets: [ | |
[ | |
'@babel/preset-env', | |
{ | |
targets: { | |
chrome: '65', | |
firefox: '59', | |
safari: '11', | |
edge: '16', | |
}, | |
modules: isTest ? 'commonjs' : false, | |
loose: true, | |
useBuiltIns: 'usage', | |
}, | |
], | |
{ | |
// Stage 2 preset as 2018-08-02 | |
plugins: [ | |
// Stage 2 | |
['@babel/plugin-proposal-decorators', { legacy: true }], | |
'@babel/plugin-proposal-function-sent', | |
'@babel/plugin-proposal-export-namespace-from', | |
'@babel/plugin-proposal-numeric-separator', | |
'@babel/plugin-proposal-throw-expressions', | |
// Stage 3 | |
'@babel/plugin-syntax-dynamic-import', | |
'@babel/plugin-syntax-import-meta', | |
['@babel/plugin-proposal-class-properties', { loose: true }], | |
'@babel/plugin-proposal-json-strings', | |
], | |
}, | |
['@babel/preset-react', { development: !isProduction }], | |
], | |
plugins: ['react-hot-loader/babel'], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment