-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbabel.config.js
48 lines (42 loc) · 1.07 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
/* eslint-disable no-undef */
const isTest = process.env.NODE_ENV === 'test';
const isDevelopment =
process.env.WEBPACK_DEV_SERVER === 'true' ||
process.env.NODE_ENV === 'development';
const presetReact = {
development: isDevelopment,
useBuiltIns: true,
runtime: "automatic"
};
/** @type import('@babel/preset-env').Options */
const presetEnv = {
loose: true,
useBuiltIns: 'usage',
corejs: 3,
modules: isTest ? 'commonjs' : false,
shippedProposals: true,
bugfixes: true, // Remove later in babel 8
};
const presetTypescript = {
isTSX: true,
allExtensions: true,
};
const pluginStyledComponents = {
displayName: isDevelopment,
pure: true,
};
const pluginEffector = {
addLoc: true,
importName: ['effector', 'effector-logger'],
};
module.exports = {
presets: [
['@babel/preset-react', presetReact],
['@babel/preset-env', presetEnv],
['@babel/preset-typescript', presetTypescript],
],
plugins: [
['babel-plugin-styled-components', pluginStyledComponents],
['effector/babel-plugin', (isDevelopment || isTest) && pluginEffector],
],
};