-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbabel.custom.config.js
41 lines (36 loc) · 1.61 KB
/
babel.custom.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
@description BABEL CUSTOM PLUGINS CONFIG
*/
const optionBabelStyleComponent =
process.env.NODE_ENV !== 'production'
? { fileName: true, minify: false, transpileTemplateLiterals: false, pure: false }
: { minify: true, transpileTemplateLiterals: true, pure: true }
const isDevPlugin = ['react-refresh/babel']
const isProdPlugin = [
'babel-plugin-transform-remove-console',
'babel-plugin-transform-remove-undefined',
'babel-plugin-transform-remove-strict-mode',
'babel-plugin-minify-dead-code-elimination',
['transform-react-remove-prop-types', { mode: 'wrap', ignoreFilenames: ['node_modules'] }]
]
exports.isProdDevPlugin = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-transform-async-to-generator',
'@babel/plugin-transform-react-constant-elements',
'@babel/plugin-transform-react-inline-elements',
'@babel/plugin-transform-shorthand-properties',
'@babel/plugin-transform-react-jsx-self',
'@babel/plugin-syntax-dynamic-import',
'babel-plugin-transform-inline-consecutive-adds',
'babel-plugin-minify-constant-folding',
'babel-plugin-minify-flip-comparisons',
'react-html-attrs',
['import-graphql', { extensions: ['.graphql', '.gql'] }],
['styled-jsx/babel', { optimizeForSpeed: true }],
['@babel/plugin-transform-runtime', { corejs: 3 }],
['babel-plugin-graphql-tag', { onlyMatchImportSuffix: true, strip: true }],
['babel-plugin-styled-components', { ...optionBabelStyleComponent }]
]
exports.isPlugins = process.env.NODE_ENV !== 'production' ? isDevPlugin : isProdPlugin