Reputation: 279
I am Building a production package of Jhipster application using gradlew -Pprod command but getting following error
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)
Before getting above Error I was getting following error but after Upadate "workbox-webpack-plugin of with version 3.0.0-alpha.3 I solved following error using this solution
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>
Please help me so solve this error
Upvotes: 3
Views: 2323
Reputation: 303
WorkboxWebpackPlugin in version 3.0 is broken into two parts to be used.
The way to use WorkboxWebpackPlugin is either
new WorkboxWebpackPlugin.GenerateSW({...})
for generating a fresh new Service worker
or
new WorkboxWebpackPlugin.InjectManifest({...})
for injecting pre-cache file list in your own service worker.
https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#configuration
Upvotes: 4