NekR / offline-plugin

Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)
MIT License
4.52k stars 295 forks source link

The problem with <HTML> automatically appends manifest.appcache #455

Closed crixusshen closed 5 years ago

crixusshen commented 5 years ago

I looked at the example in offline-plugin-pwa. The file manifest.appcache is not appended to after the build. But this file automatically append to after I integration offline-plugin into my project. I found that the implementation of offline-plugin implements the update of appcache through a iframe tag. Does it contradict the automatic injection of HTML tags?

crixusshen commented 5 years ago

I do know that pages that contain manifest= "are cached by default. So your iframe hack is the right way to do it. But I don't know that my HTML was automatically injected into the manifest tag, Is it the default behavior of the offline-plugin, or my personal problem^_^

crixusshen commented 5 years ago

I use the version of webpack is 4.36.1. the version of offline-plugin is 5.0.7

crixusshen commented 5 years ago

😝I found out why. the offline-plugin must be executed after the html-webpack-plugin. Now my HTML is not automatically injected the file of manifest.appcache. I guess that It could be the html-webpack-plugin cause. As long as the chunk contains the.appcache suffix it will be injected automatically.

GGAlanSmithee commented 5 years ago

Hey @crixusshen nice investigation 👍 and happy you fixed your issue. I submitted a PR, https://github.com/NekR/offline-plugin/pull/458, adding info regarding this to the docs, do you mind checking it out?