Skip to content

Commit 74b3512

Browse files
authored
[SOURCE_PHASE_IMPORTS] Using source phase imports should imply EXPORT_ES6 (#24440)
We do the same thing for WASM_ESM_INTEGRATION and MODULARIZE=instance already.
1 parent 32f81ec commit 74b3512

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/link.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
757757

758758
# Set the EXPORT_ES6 default early since it affects the setting of the
759759
# default oformat below.
760-
if settings.WASM_ESM_INTEGRATION or settings.MODULARIZE == 'instance':
760+
if settings.WASM_ESM_INTEGRATION or settings.SOURCE_PHASE_IMPORTS or settings.MODULARIZE == 'instance':
761761
default_setting('EXPORT_ES6', 1)
762762

763763
# If no output format was specified we try to deduce the format based on
@@ -795,6 +795,10 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
795795
if settings.JS_BASE64_API:
796796
diagnostics.warning('experimental', '-sJS_BASE64_API is still experimental and not yet supported in browsers')
797797

798+
if settings.SOURCE_PHASE_IMPORTS:
799+
if not settings.EXPORT_ES6:
800+
exit_with_error('SOURCE_PHASE_IMPORTS requires EXPORT_ES6')
801+
798802
if settings.WASM_ESM_INTEGRATION:
799803
diagnostics.warning('experimental', '-sWASM_ESM_INTEGRATION is still experimental and not yet supported in browsers')
800804
default_setting('MODULARIZE', 'instance')

0 commit comments

Comments
 (0)