Skip to content

How to import a web worker javascript file? #278

@mngb

Description

@mngb

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions