antvis / dumi-theme-antv

AntV website theme based on dumi2.
https://dumi-theme-antv.antv.vision/
MIT License
20 stars 13 forks source link

如何支持示例中使用到的 WebWorker #143

Closed xiaoiver closed 1 year ago

xiaoiver commented 2 years ago

之前使用了 gatsby 的插件:gatsby-plugin-workerize-loader gatsby 配置:https://github.com/antvis/G/blob/next/packages/site/gatsby-config.js#L9 背后使用的其实是 Webpack 插件:https://github.com/developit/workerize-loader 完整示例:https://github.com/antvis/G/blob/next/packages/site/examples/canvas/demo/offscreen-canvas.ts

在 dumi 中如何使用 WebWorker 呢?是否也可以使用 https://github.com/developit/workerize-loader 呢?

hustcc commented 2 years ago

@PeachScript 帮忙看看这个~

PeachScript commented 2 years ago

可以的,用 api.chainWebpack 把这个 loader 挂上去就行:https://next.d.umijs.org/config#chainwebpack