Comments (3)
Thanks for the report!
Could you share some more specifications and documentations of that output behavior of emscripten? I found one here, but not sure if it always does that. worker.js
could possibly be considered as an auxiliary file and uplifted for empscripten target, though we might need to understand the stability before moving forward. We might also bump into issues like #13355 and #13358 when dealing with it.
from cargo.
BTW, are there any more files for emscripten that we want to uplift to the target directory?
from cargo.
Hi @weihanglo
Thanks for a quick response! In the Special Considerations section it mentions that the worker.js
will be always generated when compiling with -pthread
flag and the file must be deployed:
Also note that when compiling code that uses pthreads, an additional JavaScript file NAME.worker.js is generated alongside the output .js file (where NAME is the basename of the main file being emitted). That file must be deployed with the rest of the generated code files.
In addition, -pthread
is not the only case when Emscripten generates a worker.js
. According to the emcc
compiler manual , when linking with --proxy-to-worker
flag it will also generate worker.js
when emitting JavaScript. Cargo always emits JavaScript and never targets HTML when building for wasm32.
--proxy-to-worker
[link] Runs the main application code in a worker, proxying events to it and output from it. If emitting HTML, this emits a .html file, and a separate .js file containing the JavaScript to be run in a worker. If emitting JavaScript, the target file name contains the part to be run on the main thread, while a second .js file with suffix â.worker.jsâ will contain the worker portion.
Emscripten choses what to emit based on a suffix of the output file: .js
for JavaScript and .html
for HTML. The following condition in cargo guarantees that Emscripten will emit JavaScript (due to .js
suffix) and therefore we get a worker.js
file.
Additional files
BTW, are there any more files for emscripten that we want to uplift to the target directory?
Yes indeed. Those files are: .data
, .data.js
and .mem
. See Build Files. data
related files are the important ones. They contain preloaded files and directories that will populate the virtual file system. See Packaging Files. It is difficult to envision an app without asset files. Please consider outputting them as well.
Cheers
from cargo.
Related Issues (20)
- Cargo packages duplicate files on case-insensitive file systems HOT 2
- Add warning for unused workspace dependency HOT 2
- non-blocking build error reported in example code since 0d62ae2 HOT 7
- Panic on use of libraries with proc-macro examples HOT 3
- maybe a typo issue that make this doc fragment confused HOT 4
- Cargo build/run not working - Bad CPU type in executable HOT 3
- Patching an indirect dependency with `package = "xxx"` renaming HOT 1
- process didn't exit successfully: (signal: 9, SIGKILL: kill) HOT 7
- Support setting target `runner` in the `[profile]` settings HOT 3
- Generate nix package from a crate HOT 2
- `nightly-2024-04-12` selects incorrect version of git dependency HOT 3
- cargo clean fails on projects using cxx for rust <> c++ bindings HOT 3
- ffmpeg-sys vs ffmpeg-sys-next HOT 3
- "cargo new" should add pre-commit hooks for autoformatter and linter HOT 7
- Nonsense rust-version values have a non-ideal error message HOT 1
- Emoji in manifest crashes annotate-snippets HOT 1
- Error building path dependency inside symlinked git repository HOT 2
- Duplicate rustflags should be de-duplicated HOT 4
- Non-default cargo locations prefer binaries from default locations over their own HOT 6
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 cargo.