-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable top level await (#2358)
Disables `experiments.topLevelAwait` in the Webpack config. This was enabled by default in Webpack `5.83.0`, but is unsupported in Snaps. With this flag disabled, trying to build a Snap with top level await will result in: ``` • Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enable it) File was processed with these loaders: * ../../node_modules/swc-loader/src/index.js You may need an additional loader to handle the result of these loaders. Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enable it) at .../node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js:68:11 at Hook.eval [as call] (eval at create (.../node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16) at Hook.CALL_DELEGATE [as _call] (.../node_modules/tapable/lib/Hook.js:14:14) at JavascriptParser.walkAwaitExpression (.../node_modules/webpack/lib/javascript/JavascriptParser.js:2893:29) at JavascriptParser.walkExpression (.../node_modules/webpack/lib/javascript/JavascriptParser.js:2820:10) at JavascriptParser.walkLeftRightExpression (.../node_modules/webpack/lib/javascript/JavascriptParser.js:3061:8) at JavascriptParser.walkLogicalExpression (.../node_modules/webpack/lib/javascript/JavascriptParser.js:3080:9) at JavascriptParser.walkExpression (.../node_modules/webpack/lib/javascript/JavascriptParser.js:2847:10) at JavascriptParser.walkVariableDeclaration (.../node_modules/webpack/lib/javascript/JavascriptParser.js:2638:33) at JavascriptParser.walkStatement (.../node_modules/webpack/lib/javascript/JavascriptParser.js:1930:10) ``` Previously the Snap would build successfully but fail running in the client.
- Loading branch information
1 parent
8cc7ad9
commit 706d7a1
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters