diff --git a/AUTHORS b/AUTHORS index 41c39938a10b1..a5559da15cc7a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -422,3 +422,4 @@ a license to everyone to use it as detailed in LICENSE.) * Egor Suvorov (copyright owned by think-cell Software GmbH) * James Kuszmaul * Wei Mingzhi +* Adrien Devresse diff --git a/emcc.py b/emcc.py index 5b74801de5e60..1f7dfab9516b7 100755 --- a/emcc.py +++ b/emcc.py @@ -3039,7 +3039,7 @@ def modularize(): # immediately anyhow, like in non-modularize mode) # In EXPORT_ES6 + USE_PTHREADS the 'thread' is actually an ES6 module webworker running in strict mode, # so doesn't have access to 'document'. In this case use 'import.meta' instead. - if shared.Settings.EXPORT_ES6 and shared.Settings.USE_PTHREADS: + if shared.Settings.EXPORT_ES6 and shared.Settings.USE_ES6_IMPORT_META: script_url = "import.meta.url" else: script_url = "typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined" diff --git a/src/settings.js b/src/settings.js index 07466e53f39ba..d80fd2a781cd5 100644 --- a/src/settings.js +++ b/src/settings.js @@ -937,6 +937,11 @@ var SEPARATE_ASM_MODULE_NAME = ''; // be enabled for ES6 exports. var EXPORT_ES6 = 0; +// Use the ES6 Module relative import feature 'import.meta.url' +// to auto-detect WASM Module path. +// It might not be supported on old browsers / toolchains +var USE_ES6_IMPORT_META = 1; + // If 1, will just time how long main() takes to execute, and not print out // anything at all whatsoever. This is useful for benchmarking. var BENCHMARK = 0;