cli: disable sucrase ES transforms

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-08-19 17:46:43 +02:00
parent d615577656
commit c0c51c9710
3 changed files with 10 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Disabled ECMAScript transforms in app and backend builds in order to reduce bundle size and runtime performance. For the rationale and a full list of syntax that is no longer transformed, see https://github.com/alangpierce/sucrase#transforms. This also enables TypeScripts `useDefineForClassFields` flag by default, which in rare occasions could cause build failures. For instructions on how to mitigate issues due to the flag, see the [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier).
+2 -1
View File
@@ -33,6 +33,7 @@
"strictPropertyInitialization": true,
"stripInternal": true,
"target": "ES2019",
"types": ["node", "jest", "webpack-env"]
"types": ["node", "jest", "webpack-env"],
"useDefineForClassFields": true
}
}
@@ -39,6 +39,7 @@ export const transforms = (options: TransformOptions): Transforms => {
loader: require.resolve('@sucrase/webpack-loader'),
options: {
transforms: ['typescript', 'jsx', ...extraTransforms],
disableESTransforms: true,
production: !isDev,
},
},
@@ -48,6 +49,7 @@ export const transforms = (options: TransformOptions): Transforms => {
loader: require.resolve('@sucrase/webpack-loader'),
options: {
transforms: ['jsx', ...extraTransforms],
disableESTransforms: true,
production: !isDev,
},
},
@@ -64,6 +66,7 @@ export const transforms = (options: TransformOptions): Transforms => {
loader: require.resolve('@sucrase/webpack-loader'),
options: {
transforms: ['jsx', ...extraTransforms],
disableESTransforms: true,
production: !isDev,
},
},