-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.babelrc.js
46 lines (42 loc) · 1.02 KB
/
.babelrc.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
const pkg = require('./package.json')
const { execSync } = require('child_process')
const pkgVersion = `${process.env.PKG_VERSION || pkg.version}`
// http://schacon.github.io/git/git-show
const buildDate = execSync('git show -s --format=%ci HEAD')
.toString()
.replace(/[\r\n]+$/, '')
const commitSha = execSync('git rev-parse --short HEAD')
.toString()
.replace(/[\r\n]+$/, '')
const plugins = [
['macros'],
[
'transform-define',
{
__VERSION__: pkgVersion,
__DEV__: process.env.NODE_ENV !== 'production',
__BUILD_DATE__: buildDate,
__COMMIT_SHA__: commitSha
}
]
]
if (process.env.NODE_ENV === 'production') {
// plugins.push(['transform-remove-console', { exclude: ['error', 'warn'] }])
// plugins.push(['transform-remove-console'])
}
module.exports = {
presets: [
[
'next/babel',
{
'preset-env': {
// debug: true,
targets: {
browsers: '>2%, not ie 11, not op_mini all'
}
}
}
]
],
plugins
}