|
1 | | -const path = require('path') |
2 | | - |
3 | | -const packageJSON = require(path.join(__dirname, 'package.json')) |
4 | | - |
5 | | -const TARGETS_NODE = '20.10' |
6 | | - |
7 | 1 | // Run `npx browserslist "defaults"` to see a list of target browsers. |
8 | 2 | const TARGETS_BROWSERS = ['defaults'] |
9 | 3 |
|
10 | | -// Warning! Recommended to specify used minor core-js version, like corejs: '3.6', |
11 | | -// instead of corejs: '3', since with '3' it will not be injected modules |
12 | | -// which were added in minor core-js releases. |
13 | | -// https://github.com/zloirock/core-js/blob/master/README.md#babelpreset-env |
14 | | -const CORE_JS_VERSION = packageJSON.devDependencies['core-js'] |
15 | | - .split('.') |
16 | | - .slice(0, 2) |
17 | | - .join('.') // Produces: 3.12, instead of 3.12.1 |
18 | | - |
19 | 4 | // We use the recommended babel configuration for monorepos, which is a base directory |
20 | 5 | // `babel.config.js` file, but then use a per-project `.babelrc.js` file. |
21 | 6 | // Learn more: https://babeljs.io/docs/en/config-files#monorepos |
22 | 7 |
|
23 | 8 | /** @type {import('@babel/core').TransformOptions} */ |
24 | 9 | module.exports = { |
25 | 10 | presets: [ |
26 | | - [ |
27 | | - '@babel/preset-env', |
28 | | - { |
29 | | - targets: { node: TARGETS_NODE }, |
30 | | - useBuiltIns: 'usage', |
31 | | - corejs: { |
32 | | - version: CORE_JS_VERSION, |
33 | | - // List of supported proposals: https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#ecmascript-proposals |
34 | | - proposals: true, |
35 | | - }, |
36 | | - exclude: [ |
37 | | - 'es.error.cause', |
38 | | - process.env.NODE_ENV !== 'test' && 'proposal-dynamic-import', |
39 | | - ].filter(Boolean), |
40 | | - }, |
41 | | - ], |
42 | 11 | ['@babel/preset-react', { runtime: 'automatic' }], |
43 | 12 | /** |
44 | 13 | * TODO(pc): w/ '@babel/plugin-transform-typescript' in plugins now, is '@babel/typescript' preset still needed? |
@@ -87,22 +56,7 @@ module.exports = { |
87 | 56 | * https://github.com/tc39/proposal-decorators |
88 | 57 | **/ |
89 | 58 | ['@babel/plugin-proposal-decorators', { legacy: true }], |
90 | | - // The "loose" option must be the same for all three of these plugins. |
91 | | - ['@babel/plugin-transform-class-properties', { loose: true }], |
92 | | - ['@babel/plugin-transform-private-methods', { loose: true }], |
93 | | - ['@babel/plugin-transform-private-property-in-object', { loose: true }], |
94 | | - [ |
95 | | - '@babel/plugin-transform-runtime', |
96 | | - { |
97 | | - // https://babeljs.io/docs/en/babel-plugin-transform-runtime/#core-js-aliasing |
98 | | - // Setting the version here also requires `@babel/runtime-corejs3` |
99 | | - corejs: { version: 3, proposals: true }, |
100 | | - // https://babeljs.io/docs/en/babel-plugin-transform-runtime/#version |
101 | | - // Transform-runtime assumes that @babel/runtime@7.0.0 is installed. |
102 | | - // Specifying the version can result in a smaller bundle size. |
103 | | - version: packageJSON.devDependencies['@babel/runtime-corejs3'], |
104 | | - }, |
105 | | - ], |
| 59 | + ['@babel/plugin-transform-runtime'], |
106 | 60 | '@babel/plugin-syntax-import-attributes', |
107 | 61 | ], |
108 | 62 | overrides: [ |
@@ -137,10 +91,6 @@ module.exports = { |
137 | 91 | ], |
138 | 92 | }, |
139 | 93 | ], |
140 | | - // normally provided through preset-env detecting TARGET_BROWSER |
141 | | - // but webpack 4 has an issue with this |
142 | | - // see https://github.com/PaulLeCam/react-leaflet/issues/883 |
143 | | - ['@babel/plugin-transform-nullish-coalescing-operator'], |
144 | 94 | ], |
145 | 95 | }, |
146 | 96 | ], |
|
0 commit comments