-
Notifications
You must be signed in to change notification settings - Fork 178
/
babel.config.js
39 lines (35 loc) · 1.08 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
module.exports = function(api) {
const defaultConfigFunc = require('shakapacker/package/babel/preset.js')
const resultConfig = defaultConfigFunc(api)
const isProductionEnv = api.env('production')
const isDevelopmentEnv = api.env('development')
const changesOnDefault = {
presets: [
[
'@babel/preset-react',
{
development: !isProductionEnv,
useBuiltIns: true
}
]
].filter(Boolean),
plugins: [
// This is little help to include individual components from Semantic UI React!
['module-resolver', {
root: ['app/webpacker'],
alias: {
'semantic-css': ([, name]) => `stylesheets/semantic/components${name}.min.css`,
}
}],
!isDevelopmentEnv && [
'babel-plugin-transform-react-remove-prop-types',
{
removeImport: true
}
]
].filter(Boolean)
}
resultConfig.presets = [...resultConfig.presets, ...changesOnDefault.presets]
resultConfig.plugins = [...resultConfig.plugins, ...changesOnDefault.plugins ]
return resultConfig
}