framework/js-packages/webpack-config/babel.config.cjs

44 lines
1.2 KiB
JavaScript
Raw Normal View History

module.exports = {
2023-06-07 18:09:34 +08:00
assumptions: {
// Defines assumptions Babel can make about our
// code to better optimise it.
//
// These are rarely used features that are generally
// considered very bad practice anyway.
//
// See: https://babeljs.io/docs/en/assumptions
constantSuper: true,
ignoreFunctionLength: true,
noDocumentAll: true,
noNewArrows: true,
privateFieldsAsProperties: true,
},
targets: {
// `not android > 0` means the build-in Android browser used up to Android 4.4 KitKat.
browsers: '>0.2%, not dead, not android > 0, not operamini all',
},
presets: [
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-typescript'),
[
require.resolve('@babel/preset-env'),
{
2023-06-07 18:09:34 +08:00
modules: 'auto',
},
],
],
plugins: [
[require.resolve('@babel/plugin-transform-runtime'), { useESModules: true }],
2023-06-07 18:09:34 +08:00
[require.resolve('@babel/plugin-proposal-class-properties')],
[require.resolve('@babel/plugin-proposal-private-methods')],
[
require.resolve('@babel/plugin-transform-react-jsx'),
{
pragma: 'm',
pragmaFrag: "'['",
useBuiltIns: true,
},
],
],
};