{"library":"rollup-plugin-web-worker-loader","title":"rollup-plugin-web-worker-loader","description":"Rollup plugin for bundling Web Workers, Service Workers, Shared Workers, Audio Worklets, and Paint Worklets. Current stable version is 1.7.0; published regularly. Supports inlining worker code or emitting separate script files via code-splitting. Handles worker dependencies, source maps, and Node.js environments. Differentiators include support for multiple worker/worklet types, Node.js compatibility, and automatic platform detection. Requires Rollup 1.9+ up to 4.x.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install rollup-plugin-web-worker-loader"],"cli":null},"imports":["import webWorkerLoader from 'rollup-plugin-web-worker-loader';","import DataWorker from 'web-worker:./DataWorker';","import ServiceWorker from 'service-worker:./ServiceWorker';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import webWorkerLoader from 'rollup-plugin-web-worker-loader';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  plugins: [\n    webWorkerLoader({\n      targetPlatform: 'auto',\n      preserveSource: false,\n      external: []\n    })\n  ],\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  }\n});\n\n// src/index.js\nimport MyWorker from 'web-worker:./MyWorker';\nconst worker = new MyWorker();\nworker.postMessage('hello');\n\n// src/MyWorker.js\nself.onmessage = (e) => {\n  postMessage('received: ' + e.data);\n};","lang":"javascript","description":"Minimal Rollup config with the plugin and a Web Worker import example.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}