@@ -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