Back to results
wesmile2020/rollup-plugin-worker(opens in a new tab)
Language: TypeScript
a rollup plugin for worker
- stars
- 6
- watchers
- 1
- forks
- 1
- open issues
- 0
- Last updated
- 11/23/2022
Language: TypeScript
a rollup plugin for worker
a rollup plugin for worker
Create a rollup.config.js and import the plugin:
const worker = require('rollup-plugin-worker'); module.exports = { plugins: [ worker({ prefix: 'worker!', plugins: [], uglify: false, }), ], };
import Worker from 'worker!./workers/worker.js'; const worker = new Worker();
Create a typing.d.ts in project and declare a module:
declare module 'worker!*' { class WebWorker extends Worker { constructor(); } export default WebWorker; }