Skip to content

Can't get correct base value in Web Worker #2571

Open
@ssssota

Description

@ssssota

Describe the bug

Can't get correct base value in Web Worker.

I configured kit.paths.base in svelte.config.js.

I can't get base path when I use web worker with vite feature (like import TestWorker from '../worker?worker')
in dev mode, production mode, and prerender time.

base always returns "" (empty string) in web worker.

Reproduction

https://github.com/ssssota/sveltekit-worker-incorrect-base

live demo: https://ssssota.github.io/sveltekit-worker-incorrect-base/

Logs

No response

System Info

sveltekit-worker-incorrect-app-module on  main is 📦 v0.0.1 via ⬢ v14.17.0 on ☁️  ap-northeast-1 took 3s
❯ npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
    Memory: 7.41 GB / 15.93 GB
  Binaries:
    Node: 14.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.20.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 94.0.4606.71
    Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.38)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.20 => 1.0.0-next.20
    @sveltejs/kit: ^1.0.0-next.180 => 1.0.0-next.180
    svelte: ^3.43.1 => 3.43.1

Severity

serious, but I can work around it

Additional Information

src/service-worker.js can't import $app/paths with build errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingservice workerStuff related to service workers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions