Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import a web worker javascript file? #278

Closed
mngb opened this issue Oct 25, 2024 · 1 comment
Closed

How to import a web worker javascript file? #278

mngb opened this issue Oct 25, 2024 · 1 comment

Comments

@mngb
Copy link

mngb commented Oct 25, 2024

The web worker create by passing a .js file as parameter:
new Worker(new URL("worker.js", import.meta.url))

when fetch the worker.js file from server, the request is:
http://127.0.0.1/assets/workers/worker.js
instead of:
http://127.0.0.1/assets/workers/worker-252df82be7cdf7c0507e119591b5c0a5649cb95544a18c1c096e6f0602e8cbb4.js

this case a 404 not found for the worker file.

I can move the worker.js file to the "public/" directly to solve this, but this is too ugly.

How to fix this?

@mngb mngb changed the title How to import a web work javascript file? How to import a web worker javascript file? Oct 25, 2024
@dhh
Copy link
Member

dhh commented Oct 25, 2024

Use RAILS_ASSET_URL rails/propshaft#207

@dhh dhh closed this as completed Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants