appcache-webpack-plugin
appcache-webpack-plugin copied to clipboard
incomplete manifest when webpack --watch
When webpack started with --watch option, the plugin generate full manifest for the first time (OK), but when a watched fie is changed and webpack regenerate outputs, the plugin regenerate the appcache manifest, but it contains only changed files. Unchanged files processed with file-loader are not included nor files from copy-webpack-plugin.
Thanks for the report! I have some ideas on how to fix this, but i'm short on time at the moment. I'll try to get back to this ASAP.
@gizocz pardon my stupid question, but why would you use manifest in development mode?
I assume you are developing when you are watching for file changes?
I'm developing the offline app, so I would like to have the manifest also during the development.
On Tue, Dec 15, 2015 at 2:36 PM, Lars Rye Jeppesen <[email protected]
wrote:
@gizocz https://github.com/gizocz pardon my stupid question, but why would you use manifest in development mode?
I assume you are developing when you are watching for file changes?
— Reply to this email directly or view it on GitHub https://github.com/lettertwo/appcache-webpack-plugin/issues/11#issuecomment-164766507 .
same problem here... missing all "assets" (file-loader, CopyWebpackPlugin) @--watch at build-nr >= 2
thx!
Maybe. If someone needs, I build my own small (typescript) loader as a workaround
(compiler: Compiler) =>
{
let cachedAssets: string[] = []
compiler.hooks.emit.tap('compilation', async (compilation: webpack.compilation.Compilation) =>
{
cachedAssets = [...cachedAssets, ...Object.keys(compilation.assets)
.map((filePath: string) => encodeURI(filePath))
.filter((filePath: string) => (
cachedAssets.indexOf(filePath) == -1 &&
!filePath.match(/.+\.map$/) &&
!filePath.match(/.+\.hot-update\.(json|js)$/)
))]
.sort()
promisify(writeFile)('dist/public/appcache.manifest', `CACHE MANIFEST\n\n${cachedAssets.join('\n')}\n\nNETWORK:\n*\n`)
})
},