You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a hacky approach to build a worker bundle in a lib mode.
It's not possible to configure the lib.formats option for every entry, and I need to configure it as an iife for the worker output. I am therefore forced to use Vite's worker loading.
Vite's worker extraction won't when a dynamic path is used, and I need a configurable path in my lib, like:
// this won't generate a worker bundleexportfunctionloadWorker(url: string){constworker=newWorker(newURL("./worker.ts",url));}
To force the extraction, I am using an unreachable code path which will get stripped out:
// unreachable code for worker extractionif(false){newWorker(newURL("./worker.ts",import.meta.url));}
I am now stuck in trying to move the worker bundle to a different folder.
worker: {format: "iife",rollupOptions: {output: {// this won't workassetFileNames: "resources/blinkid.worker.js",},},},
#7804 doesn't seem to have fully fixed worker rollup options.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I am using a hacky approach to build a worker bundle in a lib mode.
It's not possible to configure the
lib.formats
option for every entry, and I need to configure it as aniife
for the worker output. I am therefore forced to use Vite's worker loading.Vite's worker extraction won't when a dynamic path is used, and I need a configurable path in my lib, like:
To force the extraction, I am using an unreachable code path which will get stripped out:
I am now stuck in trying to move the worker bundle to a different folder.
#7804 doesn't seem to have fully fixed worker rollup options.
Reproduction
https://stackblitz.com/edit/vitejs-vite-vpk6ws?file=vite.config.js&view=editor
Steps to reproduce
npm install && npm run build
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: