emscripten-core / emscripten-core/emscripten

Data files are loaded from root, not from directory where js file is loaded from

Open
#12,288 3 comments 0 reactions 0 assignees View on GitHub
good first bug help wanted
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I have a modularized wasm module that pre-js's file_packager-produced package:
```
/index.html (that loads dist/module.js)
/dist/module.js
/dist/module.wasm
/dist/module.data
```
`module.wasm` is indeed requested as `/dist/module.wasm`, but `module.data` is requested as `/module.data`, contrary to [docs](https://emscripten.org/docs/porting/files/packaging_files.html):
```
Changing the data file location
By default, the .data file containing all the preloaded files is loaded from the same URL as your .js file.
```

Explicit `locateFile(package_name) {return '/dist/' + package_name}` helped, but it would be nice if it was not needed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.