-
Notifications
You must be signed in to change notification settings - Fork 95
/
babel.config.js
37 lines (35 loc) · 1.12 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
const path = require('path');
module.exports = (api) => {
const isTest = api.env('test');
const isProduction = api.env('production');
return {
presets: [
'@babel/react',
'@babel/preset-typescript',
[
'@babel/env',
isTest ? { targets: { node: 'current' } } : { loose: true },
],
].filter(Boolean),
plugins: [
[
'babel-plugin-module-resolver',
{
alias: {
'@hello-pangea/dnd':
process.env.USE_PRODUCTION_BUILD === 'true'
? path.resolve(__dirname, './dist/dnd.esm')
: path.resolve(__dirname, './src/index.ts'),
},
},
],
'@babel/plugin-transform-object-assign',
['@babel/plugin-transform-class-properties', { loose: true }],
['@babel/plugin-transform-private-methods', { loose: true }],
['@babel/plugin-transform-private-property-in-object', { loose: true }],
// used for stripping out the `invariant` messages in production builds
isProduction ? 'babel-plugin-dev-expression' : false,
].filter(Boolean),
comments: false,
};
};