【文件属性】:
文件名称:nextjs-worker-example:这是Webpack使用Next.js加载Web Worker的示例
文件大小:40KB
文件格式:ZIP
更新时间:2021-05-02 06:24:59
NextJS Worker示例
这是使Web Worker在NextJS项目中运行的示例。
要使用worker-loader将Web Worker加载到NextJS站点上,并允许在其worker上运行babel等webpack加载器,必须覆盖构建输出路径。
感谢。
// next.config.js
module . exports = {
webpack ( config , options ) {
config . module . rules . push ( {
test : / \. worker \. js $ / ,
loader : 'worker-loader' ,
// options: { inline: true }, // also works
options : {
name :
【文件预览】:
nextjs-worker-example-master
----next.config.js(318B)
----package.json(312B)
----pages()
--------index.js(493B)
----example.worker.js(122B)
----.gitignore(18B)
----README.md(960B)
----yarn.lock(147KB)