diff --git a/.changeset/cold-moose-raise.md b/.changeset/cold-moose-raise.md new file mode 100644 index 0000000000..cd29311b30 --- /dev/null +++ b/.changeset/cold-moose-raise.md @@ -0,0 +1,5 @@ +--- +'@ice/app': patch +--- + +fix: the judgment of unsupported syntax diff --git a/packages/ice/src/webpack/DataLoaderPlugin.ts b/packages/ice/src/webpack/DataLoaderPlugin.ts index 2726098047..1733facecb 100644 --- a/packages/ice/src/webpack/DataLoaderPlugin.ts +++ b/packages/ice/src/webpack/DataLoaderPlugin.ts @@ -52,6 +52,7 @@ export default class DataLoaderPlugin { const filePath = path.join(this.rootDir, RUNTIME_TMP_DIR, 'data-loader.ts'); if (fse.existsSync(filePath)) { const isLetSupported = isSupportedFeature('let', this.rootDir); + const isConstSupported = isSupportedFeature('const', this.rootDir); const { outputFiles, error } = await this.serverCompiler( { target: 'es6', // should not set to esnext, https://github.com/alibaba/ice/issues/5830 @@ -60,7 +61,8 @@ export default class DataLoaderPlugin { supported: { // Do not wrap arrow function when format as IIFE. arrow: false, - 'const-and-let': isLetSupported, + // If const or let is supported in browserlist, should not tansform again. + 'const-and-let': isConstSupported || isLetSupported, }, write: false, logLevel: 'silent', // The main server compile process will log it.