Skip to content

Commit 6a79599

Browse files
committed
Fix -sMODULARIZE + -sLEGACY_VM_SUPPORT
When we run babel in `-sMODULARIZE` mode the input to babel contains `await` calls. This code appears to be top-level code at the point at which we run babel since we have yet to perform the modularization process which wraps the output in a factory function. Fixes: #23687
1 parent 582267f commit 6a79599

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

test/test_other.py

+3
Original file line numberDiff line numberDiff line change
@@ -7056,6 +7056,9 @@ class Descriptor {
70567056
self.run_process([EMXX, 'src.cpp', '-O2', '-sEXPORT_ALL'])
70577057
self.assertExists('a.out.js')
70587058

7059+
def test_modularize_legacy(self):
7060+
self.do_runf('hello_world.c', emcc_args=['-sMODULARIZE', '-sLEGACY_VM_SUPPORT'])
7061+
70597062
def test_emmake_emconfigure(self):
70607063
def check(what, args, fail=True, expect=''):
70617064
args = [what] + args

tools/building.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def version_split(v):
511511
@ToolchainProfiler.profile()
512512
def transpile(filename):
513513
config = {
514-
'sourceType': 'script',
514+
'sourceType': 'module',
515515
'targets': {}
516516
}
517517
if settings.MIN_CHROME_VERSION != UNSUPPORTED:

0 commit comments

Comments
 (0)