Closed tuananh closed 6 years ago
Hey, yeah you need to add it somewhere in your bundle. I recommend this at the bottom of your src/index.js
if (process.env.NODE_ENV === 'production') {
require('offline-plugin/runtime').install();
}
Similarly, that expects that you added the plugin in production mode only.
exports.webpack = function (config, env) {
if (env.production) {
config.plugins.push(
new OfflinePlugin()
)
}
}
That'll do it for ya!
Verified this locally, and there'll now be a @pwa/plugin-offline
in the next release. Similarly, attaching Service Workers will be included in init
's scaffolding. 👍
I got this issue with offline plugin. The link in the error recommends that i add this
require('offline-plugin/runtime').install();
but i'm not sure where to add it .