This repository was archived by the owner on May 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
72 lines (65 loc) · 1.51 KB
/
babel.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//Needs a bit of cleanup
module.exports = function (api) {
//api.cache(false)
var isProd = api.cache(() => process.env.NODE_ENV === 'production')
var isCjs = api.cache(() => process.env.NODE_ENV === 'cjs')
var isEs = api.cache(() => process.env.NODE_ENV === 'es')
const modules = isEs ? false : 'commonjs'
const targets = isProd ?
{ node: '10' } :
isCjs ?
{ esmodules: true } :
{ browsers: 'last 4 versions' }
const presets = [
[
'@babel/preset-env',
{
modules,
targets
// debug:true,
}
],
'@babel/preset-react'
]
const plugins = [
['module-resolver', {
root :['./src'],
alias:{
'core' :'@fwrlines/ds.core',
'ds-core':'@fwrlines/ds.core'
}
}],
['@babel/plugin-proposal-class-properties', { 'loose': true }],
['babel-plugin-inline-import', {
'extensions':[
'.html',
'.graphql',
'.gql'
]}],
/*
['transform-react-remove-prop-types', {
'mode':'wrap',
}],
*/
['add-module-exports'],
]
/* We comment out this part because it's probably better to remove the proptypes in the final react app instead of in the compilation process
if(isEs || isCjs) { plugins.push(
[
'transform-react-remove-prop-types',
{
removeImport:true
},
],
)}
*/
/*const env = { //UNUSED (??)
'production': {
'plugins': ['transform-react-remove-prop-types']
}
}*/
return {
presets,
plugins
}
}