Comments (10)
I've hit this issue as well after recently updating emsdk. What is the disposition here? Is there a workaround that doesn't involve manual patching?
edit: reverting to v3.1.57 is one workaround - that seems to be the last version before this change in url construction.
from emscripten.
The issue may have been missing the -sPTHREAD_POOL_SIZE=1
(or otherwise creating a worker to run a thread in the C code), since without that the allocateUnusedWorker
function isn't called. I've opened a PR to fix the generated JS code and update the test: #22165
from emscripten.
Hmm.. it seems odd to me that new URL(import.meta.url)
doesn't work as expected. shouldn't that be exactly the same as new URL('basename.js', import.meta.url)
?
If webpack is expanding import.meta.url
to "file:///Users/will/repos/webgpu-cpp-wasm/web/src/cpp/wgpu_app.js"
then that would be wrong even in the later case above, no? Or is that expansion not happening when URL is constructed with two argument?
from emscripten.
Regarding the self-dependency, do we really want to suppress that warning? I mean, the file really does depend on itself.. that is how it works.. we don't want webpack to thing any different do we?
from emscripten.
@RReverser does new URL('{{{ JS_FILE }}}', import.meta.url)
make sense for some reason over new URL(import.meta.url)
when trying to get the URL of the current file?
from emscripten.
I hadn't found it in the docs earlier, but looking at webpack's docs on import.meta
: https://webpack.js.org/blog/2020-10-10-webpack-5-release/#importmeta :
import.meta.url
is thefile:
url of the current file (similar to__filename
but as file url)
So it sounds like new URL(import.meta.url)
translating to the file://
URL is expected behavior from webpack.
In the native worker support section they mention using the new Worker(new URL("file.js", import.meta.url))
syntax: https://webpack.js.org/blog/2020-10-10-webpack-5-release/#native-worker-support . It seems like Vite is similar: https://vitejs.dev/guide/assets#new-url-url-import-meta-url ? I'm not much of a web bundling expert though. So maybe using new URL('{{{ JS_FILE }}}', import.meta.url)
is the right pattern for bundlers?
Omitting the .href
and having the circular dependency is fine for me (it also sounds like it may cause Vite to not process things the way someone would want?). In our app we add the release version to our JS file names so they're unique whether webpack renames them or not.
from emscripten.
I'm trying to reproduce the issue using webpack in our test harness, but I'm struggling to do so.
I've added a webpack test that includes EXPORT_ES6 here: #22142
However, I can't seem to make it work with pthreads, with or without EXPORT_ES6.
from emscripten.
@RReverser does
new URL('{{{ JS_FILE }}}', import.meta.url)
make sense for some reason overnew URL(import.meta.url)
when trying to get the URL of the current file?
Yeah the former is recognised as a pattern by a lot of bundlers, but the latter isn't, even though in runtime they'd be the same, yes.
from emscripten.
@RReverser does
new URL('{{{ JS_FILE }}}', import.meta.url)
make sense for some reason overnew URL(import.meta.url)
when trying to get the URL of the current file?Yeah the former is recognised as a pattern by a lot of bundlers, but the latter isn't, even though in runtime they'd be the same, yes.
Damn.. thats kind of a shame. IMHO, the later is much cleaner since its independent of that actual filename.
The former requires that extra tempting step, more characters, and is not portable across file renames.
from emscripten.
I'd be happy to see a PR submitted to fix this, and hopefully it can come with and update to test_webpack_es6
that reproduces this failure and shows that its fixes.
from emscripten.
Related Issues (20)
- `std::log1p(x)` with long double appears to use double precision HOT 7
- Support `rpath` to locate shared libraries? HOT 1
- compile gmp 6.3.0,there are some error HOT 1
- pthread workers 100% CPU usage... HOT 18
- 3.1.61 ignores wasmMemory when creating module HOT 3
- (0, 0) mouse click in emscripten_set_mousedown_callback HOT 4
- IGNORE_MISSING_MAIN compiler has no effect HOT 11
- `emscripten_set_mousedown_callback` does not call the callback function from Qt Creator HOT 40
- WebIDL Binder does not support the full range of values for unsigned integers HOT 6
- Emscripten Compiler optimization HOT 2
- Outdated package link on emscripten.org HOT 2
- new (std::nothrow) with optimizations exhibiting some strange behavior HOT 4
- Has ldinfo.c been intentionally excluded from libc? HOT 3
- `_emscripten_memcpy_js` runtime crash with MAIN/SIDE_MODULE + WASM_BIGINT HOT 9
- No list of possible EXPORTED_RUNTIME_METHODS available in documentation. HOT 2
- CompileError HOT 2
- emscripten settings about MEMORY HOT 1
- Compiler crashes when compiling OpenCV 4.10.0 with `-fwasm-exceptions` HOT 2
- Source map ignoreList support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emscripten.