File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
snaps-execution-environments/src/common Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,8 @@ export async function getDefaultConfiguration(
166166 *
167167 * @see https://webpack.js.org/configuration/output/#outputlibrarytarget
168168 */
169- type : 'commonjs' ,
169+ type : 'global' ,
170+ name : 'exports' ,
170171 } ,
171172
172173 /**
@@ -177,7 +178,7 @@ export async function getDefaultConfiguration(
177178 *
178179 * @see https://webpack.js.org/configuration/output/#outputchunkformat
179180 */
180- chunkFormat : 'commonjs ' ,
181+ chunkFormat : 'module ' ,
181182 } ,
182183
183184 /**
@@ -386,14 +387,7 @@ export async function getDefaultConfiguration(
386387 * @see https://webpack.js.org/configuration/experiments
387388 */
388389 experiments : {
389- /**
390- * Experimental support for top level await.
391- *
392- * This is unsupported in Snaps and therefore disabled.
393- *
394- * @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait
395- */
396- topLevelAwait : false ,
390+ outputModule : true ,
397391 } ,
398392
399393 /**
Original file line number Diff line number Diff line change @@ -416,8 +416,9 @@ export class BaseSnapExecutor {
416416 compartment . globalThis . global = compartment . globalThis ;
417417 compartment . globalThis . window = compartment . globalThis ;
418418
419- await this . executeInSnapContext ( snapId , ( ) => {
419+ await this . executeInSnapContext ( snapId , async ( ) => {
420420 compartment . evaluate ( sourceCode ) ;
421+ await snapModule . exports ;
421422 this . registerSnapExports ( snapId , snapModule ) ;
422423 } ) ;
423424 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments