Skip to content

Commit

Permalink
hotFix: unsupported syntax in dataLoader (#6646)
Browse files Browse the repository at this point in the history
* fix: unsupported syntax judgment

* chore: add changelog
  • Loading branch information
chenjun1011 authored Nov 13, 2023
1 parent 86964a7 commit 0953dec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cold-moose-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ice/app': patch
---

fix: the judgment of unsupported syntax
4 changes: 3 additions & 1 deletion packages/ice/src/webpack/DataLoaderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 0953dec

Please sign in to comment.