You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression bug: Relative import of ES6 WASM modules from ES6 Modules does not work #9233
Regression bug introduced by the PR #8940 related to the bug #8729.
Problem :
The PR is based on the fact that 'document.currentScript.src' exists in ES6 modules.
This is not the case for VanillaJS ( no magic bundling ) for Firefox>=68 and Chrome>=76.
This causes any import of ES6 module which is not in the same directory that the source html file to fail.
Reproduce :
Generate a ES6 WASM + js hello_world in a subdirectory
Create a parent main.html page + main.js vanillaJS ES6 module in a parent directory
Import the hello_world from the main.js.
It will fail: The hello_world.js will not succeed to fetch the WASM file.
Temporary Fix :
Override the "locateFile" in the Module itself with a callback that enforce the WASM module path
Definitive Fix:
Enforce the usage of PTHREAD and WebWorker is not a good solution considering that this support is disable in almost all the main WebBrowser for now.
I would be for adding a flag to disable "import.meta.url" on demand. And enable it by default for ANY ES6_MODULE.
So if I'm understanding your use case right, your example uses document.currentScript.src, but you want it to use import.meta.url? Before this PR #8306document.currentScript.src was always used. So this only worked between PR #8306 and PR #8940 (May-July). So while it is a regression it's not that far back.
I guess adding a new flag might be the only solution that keeps everyone happy. I don't really like it, there's already about 200 flags and I was hoping that the toolchain could determine what's best.
Hi Tim,
I was using a version between this two PR yes.
A new flag sounds an appropriate solution to me that can be deprecated in few years when the support for import.meta is universal.
Activity
Add a specific flag to enable / disable the use of 'import.meta.url'
kripken commentedon Aug 14, 2019
cc @VirtualTim
adevress commentedon Aug 14, 2019
Just added a pull request #9234 with a proposed Fix.
Please do not hesitate to tell me if you do not like the solution.
VirtualTim commentedon Aug 15, 2019
So if I'm understanding your use case right, your example uses
document.currentScript.src, but you want it to useimport.meta.url? Before this PR #8306document.currentScript.srcwas always used. So this only worked between PR #8306 and PR #8940 (May-July). So while it is a regression it's not that far back.I guess adding a new flag might be the only solution that keeps everyone happy. I don't really like it, there's already about 200 flags and I was hoping that the toolchain could determine what's best.
This issue is also related to #5104.
adevress commentedon Aug 15, 2019
Hi Tim,
I was using a version between this two PR yes.
A new flag sounds an appropriate solution to me that can be deprecated in few years when the support for import.meta is universal.
Add a specific flag to enable / disable the use of 'import.meta.url' (#…
adevress commentedon Aug 23, 2019
Problem solved. Thanks guys
Add a specific flag to enable / disable the use of 'import.meta.url' (e…
sbc100 commentedon Dec 16, 2024
Is anyone still using the
USE_ES6_IMPORT_METAsetting? I'm hoping to remove it: #23171