Skip to content

Commit aedb680

Browse files
committed
Add a specific flag to enable / disable the use of 'import.meta.url'
This fixes the problem reported by emscripten-core#9233 and by emscripten-core#8729 while fixing the regression bug causes by emscripten-core#8940
1 parent 7ee5683 commit aedb680

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,4 @@ a license to everyone to use it as detailed in LICENSE.)
422422
* Egor Suvorov <[email protected]> (copyright owned by think-cell Software GmbH)
423423
* James Kuszmaul <[email protected]>
424424
* Wei Mingzhi <[email protected]>
425+
* Adrien Devresse <[email protected]>

emcc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3039,7 +3039,7 @@ def modularize():
30393039
# immediately anyhow, like in non-modularize mode)
30403040
# In EXPORT_ES6 + USE_PTHREADS the 'thread' is actually an ES6 module webworker running in strict mode,
30413041
# so doesn't have access to 'document'. In this case use 'import.meta' instead.
3042-
if shared.Settings.EXPORT_ES6 and shared.Settings.USE_PTHREADS:
3042+
if shared.Settings.EXPORT_ES6 and shared.Settings.USE_ES6_IMPORT_META:
30433043
script_url = "import.meta.url"
30443044
else:
30453045
script_url = "typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined"

src/settings.js

+5
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,11 @@ var SEPARATE_ASM_MODULE_NAME = '';
937937
// be enabled for ES6 exports.
938938
var EXPORT_ES6 = 0;
939939

940+
// Use the ES6 Module relative import feature 'import.meta.url'
941+
// to auto-detect WASM Module path.
942+
// It might not be supported on old browsers / toolchains
943+
var USE_ES6_IMPORT_META = 1;
944+
940945
// If 1, will just time how long main() takes to execute, and not print out
941946
// anything at all whatsoever. This is useful for benchmarking.
942947
var BENCHMARK = 0;

0 commit comments

Comments
 (0)