Skip to content

cargo web doesn't serve or deploy Emscripten .data files #254

@KeyboardDanni

Description

@KeyboardDanni

When using --preload-file in the Emscripten target linker arguments, the toolchain will generate a file called crate-name.data containing the specified files to serve alongside the .js and .wasm files. However, cargo web doesn't seem to be aware of this as it only copies the .js and .wasm to the output directory, and the .data file is effectively missing when using cargo web start or cargo web deploy. The .data file is left within deps/ and while you can copy it into static/ as a workaround, it is easy to end up with a stale version of this file, which can cause problems if the generated .js file is newer than the .data file (since the .js file contains the offsets into the .data file for each virtual file).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions