-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
babel.config.js
58 lines (58 loc) · 2.22 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
/**
* @type {import('@babel/core').TransformOptions}
*/
module.exports = function (api) {
const envName = api.env();
const development = envName === 'development' || envName === 'test';
return {
presets: [
[
'@babel/preset-env',
{useBuiltIns: 'entry', corejs: '3.0', bugfixes: true},
],
['@babel/preset-typescript'],
['@babel/preset-react', {development, useBuiltIns: true}],
],
assumptions: {
setPublicClassFields: true,
privateFieldsAsProperties: true,
// nothing accesses `document.all`:
noDocumentAll: true,
// nothing relies on class constructors invoked without `new` throwing:
noClassCalls: true,
// nothing should be relying on tagged template strings being frozen:
mutableTemplateObject: true,
// nothing is relying on Function.prototype.length:
ignoreFunctionLength: true,
// nothing is relying on mutable re-exported bindings:
constantReexports: true,
// don't bother marking Module records non-enumerable:
enumerableModuleMeta: true,
// nothing uses [[Symbol.toPrimitive]]:
// (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive)
ignoreToPrimitiveHint: true,
// nothing relies on spread copying Symbol keys: ({...{ [Symbol()]: 1 }})
objectRestNoSymbols: true,
// nothing relies on `new (() => {})` throwing:
noNewArrows: true,
// transpile object spread to assignment instead of defineProperty():
setSpreadProperties: true,
// nothing should be using custom iterator protocol:
skipForOfIteratorClosing: true,
// nothing inherits from a constructor function with explicit return value:
superIsCallableConstructor: true,
// nothing relies on CJS-transpiled namespace imports having all properties prior to module execution completing:
noIncompleteNsImportDetection: true,
},
babelrcRoots: [
'.',
// Note: The following projects use rootMode: 'upward' to inherit
// and merge with this root level config.
'./polaris-codemods',
'./polaris-migrator',
'./polaris-tokens',
'./polaris-icons',
'./polaris-react',
],
};
};