[bug] Importing javascript for webworker does not work on Mac OS webview for prod build
Describe the bug
When I try to import a webworker in prod build, the worker script fails to parse. It looks like the server is responding with HTML, not the javascript file, and I see error "SyntaxError: Unexpected token '<'" in the dev tools console.
In dev build everything works as expected. Is there a bug here, or am I importing the worker incorrectly?
Reproduction
Link to minimal tauri app for reproduction: https://github.com/mattijauhiainen/WebWorkerRepro/commit/2f14494d429f969d5ae0389cc30a68b3f06d3bd1
To reproduce
- Run the app with
npm run tauri build - Observe the error in dev tools
Reproduces on Mac OS, have not tested on other platforms.
Expected behavior
Expected behaviour is the worker script to parse and execute the log statement.
Full tauri info output
> [email protected] tauri /Users/matti/work/WebWorkerRepro
> tauri "info"
[✔] Environment
- OS: Mac OS 14.5.0 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.72.0 (5680fa18f 2023-08-23)
✔ cargo: 1.72.0 (103a7ff2e 2023-08-15)
✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 18.18.2
- pnpm: 8.15.4
- npm: 9.8.1
- bun: 1.0.3
[-] Packages
- tauri [RUST]: 1.6.7
- tauri-build [RUST]: 1.5.2
- wry [RUST]: 0.24.10
- tao [RUST]: 0.16.9
- @tauri-apps/api [NPM]: 1.5.6
- @tauri-apps/cli [NPM]: 1.5.14
[-] App
- build-type: bundle
- CSP: unset
- distDir: ../dist
- devPath: http://localhost:1420/
- bundler: Vite
### Stack trace
_No response_
### Additional context
_No response_
Can you try changing the worker file to a normal javascript (.js instead of .ts) and see if that works?
Can you try changing the worker file to a normal javascript (.js instead of .ts) and see if that works?
Doesn't seem to help, getting the same error. Tried this https://github.com/mattijauhiainen/WebWorkerRepro/commit/7f663941779ce4d07ab8cda48ee14be1eeb9abba and this https://github.com/mattijauhiainen/WebWorkerRepro/commit/eeb7e3880686ed299b9373fd0f1c3e01f8358ec7