Skip to content

Commit 6827eb5

Browse files
committed
Fix proxy-to-worker + modularize error reporting
This configuration is not supported by was going undetected when `-sEXPORT_ES6` was used due to the order to checking vs setting the `MODULARIZE` setting.
1 parent 2504d4a commit 6827eb5

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

test/test_other.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14971,7 +14971,6 @@ def test_standalone_whole_archive(self):
1497114971
@parameterized({
1497214972
'': ([],),
1497314973
'single_file': (['-sSINGLE_FILE'],),
14974-
'single_file_es6': (['-sSINGLE_FILE', '-sEXPORT_ES6', '--extern-post-js', test_file('modularize_post_js.js')],),
1497514974
})
1497614975
def test_proxy_to_worker(self, args):
1497714976
self.do_runf('hello_world.c', emcc_args=['--proxy-to-worker'] + args)

tools/link.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,20 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
915915
# When using MINIMAL_RUNTIME, symbols should only be exported if requested.
916916
default_setting('EXPORT_KEEPALIVE', 0)
917917

918-
if settings.STRICT_JS and (settings.MODULARIZE or settings.EXPORT_ES6):
919-
exit_with_error("STRICT_JS doesn't work with MODULARIZE or EXPORT_ES6")
918+
if settings.EXPORT_ES6:
919+
if not settings.MODULARIZE:
920+
# EXPORT_ES6 requires output to be a module
921+
if 'MODULARIZE' in user_settings:
922+
exit_with_error('EXPORT_ES6 requires MODULARIZE to be set')
923+
settings.MODULARIZE = 1
924+
if settings.ENVIRONMENT_MAY_BE_NODE and not settings.USE_ES6_IMPORT_META:
925+
# EXPORT_ES6 + ENVIRONMENT=*node* requires the use of import.meta.url
926+
if 'USE_ES6_IMPORT_META' in user_settings:
927+
exit_with_error('EXPORT_ES6 and ENVIRONMENT=*node* requires USE_ES6_IMPORT_META to be set')
928+
settings.USE_ES6_IMPORT_META = 1
929+
930+
if settings.STRICT_JS and settings.MODULARIZE:
931+
exit_with_error("STRICT_JS doesn't work with MODULARIZE")
920932

921933
if not options.shell_path:
922934
# Minimal runtime uses a different default shell file
@@ -926,7 +938,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
926938
options.shell_path = DEFAULT_SHELL_HTML
927939

928940
if settings.STRICT:
929-
if not settings.MODULARIZE and not settings.EXPORT_ES6:
941+
if not settings.MODULARIZE:
930942
default_setting('STRICT_JS', 1)
931943
default_setting('DEFAULT_TO_CXX', 0)
932944
default_setting('IGNORE_MISSING_MAIN', 0)
@@ -1441,18 +1453,6 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
14411453

14421454
set_initial_memory()
14431455

1444-
if settings.EXPORT_ES6:
1445-
if not settings.MODULARIZE:
1446-
# EXPORT_ES6 requires output to be a module
1447-
if 'MODULARIZE' in user_settings:
1448-
exit_with_error('EXPORT_ES6 requires MODULARIZE to be set')
1449-
settings.MODULARIZE = 1
1450-
if settings.ENVIRONMENT_MAY_BE_NODE and not settings.USE_ES6_IMPORT_META:
1451-
# EXPORT_ES6 + ENVIRONMENT=*node* requires the use of import.meta.url
1452-
if 'USE_ES6_IMPORT_META' in user_settings:
1453-
exit_with_error('EXPORT_ES6 and ENVIRONMENT=*node* requires USE_ES6_IMPORT_META to be set')
1454-
settings.USE_ES6_IMPORT_META = 1
1455-
14561456
if settings.MODULARIZE and not settings.DECLARE_ASM_MODULE_EXPORTS:
14571457
# When MODULARIZE option is used, currently requires declaring all module exports
14581458
# individually - TODO: this could be optimized

0 commit comments

Comments
 (0)