forked from handsontable/handsontable
-
Notifications
You must be signed in to change notification settings - Fork 1
/
babel.config.js
95 lines (92 loc) · 2.26 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const allowedE2EModules = [
'window',
'jasmine-co',
'jest-matcher-utils',
'html-parse-stringify',
'core-js/*',
'regenerator-runtime/runtime',
'@babel/runtime/*',
'./htmlNormalize',
'./common',
'./../bootstrap',
'./helpers/custom-matchers',
'./asciiTable',
'./MemoryLeakTest',
'../MemoryLeakTest',
];
const babelPresetConfig = () => ({
targets: {
chrome: '41',
firefox: '34',
ie: '9',
safari: '9'
},
modules: false,
debug: false,
useBuiltIns: 'usage',
corejs: 3,
});
module.exports = {
presets: [
['@babel/preset-env', babelPresetConfig()]
],
plugins: [
['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }],
['transform-inline-environment-variables']
],
env: {
// Environment for unit testing, source code and languages building via webpack (UMD).
commonjs: {
plugins: [
['@babel/plugin-transform-runtime', {
corejs: false,
helpers: true,
regenerator: true,
useESModules: false,
}],
['@babel/plugin-transform-modules-commonjs', { loose: true }]
]
},
// Environment for transpiling files to be compatible with CommonJS.
commonjs_dist: {
plugins: [
['@babel/plugin-transform-modules-commonjs', { loose: true }],
['babel-plugin-transform-require-ignore', { extensions: ['.css'] }]
],
ignore: [
'src/plugins/**/test/**'
]
},
// Environment for transpiling files to be compatible with ES Modules.
es: {
plugins: [
['babel-plugin-transform-require-ignore', { extensions: ['.css'] }]
],
ignore: [
'src/plugins/**/test/**'
]
},
// Environment for building E2E tests (UMD).
commonjs_e2e: {
plugins: [
['@babel/plugin-transform-runtime', {
corejs: false,
helpers: true,
regenerator: true,
useESModules: false,
}],
['@babel/plugin-transform-modules-commonjs', { loose: true }],
['babel-plugin-forbidden-imports', {
allowedModules: allowedE2EModules
}]
],
ignore: [
'src/plugins/**/test/**'
]
},
},
ignore: [
'src/3rdparty/walkontable/dist/',
'src/3rdparty/walkontable/test/dist/'
]
};