Skip to content

Instantly share code, notes, and snippets.

@gcangussu
Created September 21, 2018 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gcangussu/a8a9c39bffd455c535630c8f1052f99e to your computer and use it in GitHub Desktop.
Save gcangussu/a8a9c39bffd455c535630c8f1052f99e to your computer and use it in GitHub Desktop.
Babel config for front end
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