A Vite plugin that bundles classic web workers during development, mirroring build-time behavior. Current stable version is 1.0.0, released with a single patch update. Key differentiator: it ensures workers are bundled in dev, preventing issues like missing imports that occur when using raw `new Worker(new URL(...))` patterns. Lightweight and simple, it builds on esbuild for fast bundling. Alternatives like `vite-plugin-worker` or manual handling are more complex or don't cover dev-time bundling. Includes filtering options via `include`/`exclude`.
npm install vite-plugin-prebundle-workersVerified import paths — ran on the pinned version, not inferred.
Configures the plugin to bundle .worker.ts files during dev, with custom esbuild define.
Always specify either `include` or `exclude` option.
Use the standard Vite worker pattern: `new Worker(new URL('./worker.ts', import.meta.url))`.Avoid mixing the plugin with Vite's native worker imports; use one approach.
Treat workers as separate bundles; do not rely on Vite HMR inside workers.
Check esbuild documentation for supported options; test your worker's imports.
Add `include: 'src/**/*.worker.ts'` or an appropriate pattern to the plugin options.
Ensure the worker path matches the `include` pattern and that the plugin is properly configured.
Use esbuild `define` in `configureEsBuild` to replace `process.env`, or remove Node-specific references.