新的WorkboxPlugin({})引发了TypeError: WorkboxPlugin不是一个构造函数。

3

我正在使用gradlew -Pprod命令构建Jhipster应用程序的生产包,但出现以下错误

D:\My Project\other\beequote\webpack\webpack.prod.js:89
        new WorkboxPlugin({
        ^

TypeError: WorkboxPlugin is not a constructor
    at Object.<anonymous> (D:\My Project\other\beequote\webpack\webpack.prod.js:89:9)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at requireConfig (D:\My Project\other\beequote\node_modules\webpack\bin\convert-argv.js:97:18)
    at D:\My Project\other\beequote\node_modules\webpack\bin\convert-argv.js:104:17
    at Array.forEach (<anonymous>)
    at module.exports (D:\My Project\other\beequote\node_modules\webpack\bin\convert-argv.js:102:15)
    at yargs.parse (D:\My Project\other\beequote\node_modules\webpack\bin\webpack.js:171:41)
    at Object.Yargs.self.parse (D:\My Project\other\beequote\node_modules\webpack\node_modules\yargs\yargs.js:533:18)
    at Object.<anonymous> (D:\My Project\other\beequote\node_modules\webpack\bin\webpack.js:152:7)
    at Module._compile (module.js:635:30)

在遇到上述错误之前,我一直遇到以下错误,但是在更新"workbox-webpack-plugin"的版本为3.0.0-alpha.3之后,我使用了此解决方案来解决以下错误。
Error: workbox-sw is needed by the service worker and could not be copied over to your new site. Error: EPERM: operation not permitted, open 'C:\projects\jhipster-app\build\www\workbox-sw.prod.v2.1.2.js'
    at Promise.all.then.catch (C:\projects\jhipster-app\node_modules\workbox-build\build\lib\utils\copy-workbox-sw.js:17:13)
    at <anonymous>

请帮助我解决这个错误


请编辑您的问题,包括JHipster版本和您所更改的详细信息。您是否尝试在最新版本生成的新项目上重现该问题? - Gaël Marziou
1个回答

3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接