Skip to content

Commit 7d250f8

Browse files
adevresskripken
authored andcommitted
Add a specific flag to enable / disable the use of 'import.meta.url' (#9234)
This fixes the problem reported by #9233 and by #8729 while fixing the regression bug causes by #8940
1 parent 2fe944f commit 7d250f8

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
@@ -3043,7 +3043,7 @@ def modularize():
30433043
# immediately anyhow, like in non-modularize mode)
30443044
# In EXPORT_ES6 + USE_PTHREADS the 'thread' is actually an ES6 module webworker running in strict mode,
30453045
# so doesn't have access to 'document'. In this case use 'import.meta' instead.
3046-
if shared.Settings.EXPORT_ES6 and shared.Settings.USE_PTHREADS:
3046+
if shared.Settings.EXPORT_ES6 and shared.Settings.USE_ES6_IMPORT_META:
30473047
script_url = "import.meta.url"
30483048
else:
30493049
script_url = "typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined"

src/settings.js

+5
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,11 @@ var SEPARATE_ASM_MODULE_NAME = '';
941941
// be enabled for ES6 exports.
942942
var EXPORT_ES6 = 0;
943943

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

0 commit comments

Comments
 (0)