(compiler)
| 17 | |
| 18 | class WasmChunksFixPlugin { |
| 19 | apply(compiler) { |
| 20 | compiler.hooks.thisCompilation.tap('WasmChunksFixPlugin', (compilation) => { |
| 21 | compilation.hooks.processAssets.tap({ name: 'WasmChunksFixPlugin' }, (assets) => |
| 22 | Object.entries(assets).forEach(([pathname, source]) => { |
| 23 | if (!pathname.match(/\.wasm$/)) return; |
| 24 | // https://github.com/hasharchives/wasm-ts-esm-in-node-jest-and-nextjs/blob/main/web-app/pages/api/wasm-package-answer.ts |
| 25 | // compilation.deleteAsset(pathname); |
| 26 | const name = pathname.split('/')[1]; |
| 27 | const info = compilation.assetsInfo.get(pathname); |
| 28 | compilation.emitAsset(name, source, info); |
| 29 | }), |
| 30 | ); |
| 31 | }); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // Overrides for css-loader plugin |
no test coverage detected