forked from Shopify/web-configs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.js
40 lines (35 loc) · 849 Bytes
/
node.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
const nonStandardPlugins = require('./non-standard-plugins');
module.exports = function shopifyNodePreset(_api, options = {}) {
const {
version = 'current',
modules = 'commonjs',
corejs = 2,
debug = false,
useBuiltIns = 'entry',
typescript = false,
} = options;
const presets = [
[
require.resolve('@babel/preset-env'),
{
modules,
useBuiltIns,
corejs,
targets: {
node: version,
},
debug,
bugfixes: true,
},
],
];
const plugins = [
...nonStandardPlugins(options),
require.resolve('@babel/plugin-proposal-dynamic-import'),
require.resolve('@babel/plugin-transform-modules-commonjs'),
];
if (typescript) {
presets.push(require.resolve('@babel/preset-typescript'));
}
return {presets, plugins};
};