Plugins for Web Workers.
import FooWorker from 'worker:./foo.worker.ts';
npm install @pixi/webworker-plugins --save-dev
Jest transform for Web Workers.
Add the following code to your jest.config.js:
module.exports = {
transform: {
'\\.worker.ts$': '@pixi/webworker-plugins/lib/jest-transform',
},
moduleNameMapper: {
'^worker:(.*)$': '$1',
},
// ...
};
Rollup plugin for Web Workers.
Add the following code to your rollup.config.mjs:
import webworker from '@pixi/webworker-plugins/rollup-plugin';
export default {
plugins: [
webworker(),
],
// ...
};