@@ -915,6 +915,12 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
915
915
# When using MINIMAL_RUNTIME, symbols should only be exported if requested.
916
916
default_setting ('EXPORT_KEEPALIVE' , 0 )
917
917
918
+ if settings .EXPORT_ES6 and not settings .MODULARIZE :
919
+ # EXPORT_ES6 requires output to be a module
920
+ if 'MODULARIZE' in user_settings :
921
+ exit_with_error ('EXPORT_ES6 requires MODULARIZE to be set' )
922
+ settings .MODULARIZE = 1
923
+
918
924
if settings .STRICT_JS and (settings .MODULARIZE or settings .EXPORT_ES6 ):
919
925
exit_with_error ("STRICT_JS doesn't work with MODULARIZE or EXPORT_ES6" )
920
926
@@ -926,7 +932,7 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
926
932
options .shell_path = DEFAULT_SHELL_HTML
927
933
928
934
if settings .STRICT :
929
- if not settings .MODULARIZE and not settings . EXPORT_ES6 :
935
+ if not settings .MODULARIZE :
930
936
default_setting ('STRICT_JS' , 1 )
931
937
default_setting ('DEFAULT_TO_CXX' , 0 )
932
938
default_setting ('IGNORE_MISSING_MAIN' , 0 )
@@ -1441,17 +1447,11 @@ def phase_linker_setup(options, state): # noqa: C901, PLR0912, PLR0915
1441
1447
1442
1448
set_initial_memory ()
1443
1449
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
1450
+ if settings .EXPORT_ES6 and 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
1455
1456
1456
if settings .MODULARIZE and not settings .DECLARE_ASM_MODULE_EXPORTS :
1457
1457
# When MODULARIZE option is used, currently requires declaring all module exports
0 commit comments