Skip to content

[SOURCE_PHASE_IMPORTS] Using source phase imports should imply EXPORT_ES6 #24440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915

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

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

if settings.SOURCE_PHASE_IMPORTS:
if not settings.EXPORT_ES6:
exit_with_error('SOURCE_PHASE_IMPORTS requires EXPORT_ES6')

if settings.WASM_ESM_INTEGRATION:
diagnostics.warning('experimental', '-sWASM_ESM_INTEGRATION is still experimental and not yet supported in browsers')
default_setting('MODULARIZE', 'instance')
Expand Down