Support: Web Worker import with query suffixes

Open
#3,412 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
deno, typescript, vite
Domain
backend

Research direction

Start by tracing how Fresh handles SSR imports and how it resolves module specifiers containing query suffixes. Reproduce the failure with a Web Worker import such as ./worker?worker&url, then check the SSR import path against Vite's documented query suffix behavior. Done means the import resolves without the reported not-found error and can be used with audioWorklet.addModule.

Written by the indexing model from the issue text.

Description

bug

Vite supports importing Web Workers with query suffixes, e.g. import MyWorker from './worker?worker&url';, which can then be used to for example add an audio worklet audioContext.audioWorklet.addModule(MyWorker);

https://vite.dev/guide/features.html#import-with-query-suffixes

Currently an error is thrown:

[vite] (ssr) Error when evaluating SSR module fresh:server_entry: Import 'file:///User/.../MyWorker.ts%3Fworker&url' failed, not found.

at wbindgen_error_new (https://jsr.io/@deno/loader/0.3.5/src/lib/rs_lib.internal.js:1073:15)
at wasm://wasm/01438d62:wasm-function 11086] :0x404151 
at wasm://wasm/01438d62:wasm-function 4736]:0x39979c 
at wasm://wasm/01438d62:wasm-function[118] :0x3e24d 
at wasm://wasm/01438d62:wasm-function[1983]:0x3011cb 
at wasm://wasm/ 01438d62:wasm-function 10418:0x3fb858 
at wasm://wasm/ 01438d62:wasm-function 11766:0x4081aa
at __wbg_adapter_54 (https://jsr.io/@deno/loader/0.3.5/src/lib/rs_lib.internal.js:252:8)
at real (https://jsr.io/@deno/loader/0.3.5/src/lib/rs_lib.internal.js:156:14)
at ext: core/01_core.js:295:9
Dominant language
TypeScript
Stars
13.8k
Forks
757
Avg merge
3m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from freshframework/fresh

All issues in freshframework/fresh

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.