appcache-webpack-plugin icon indicating copy to clipboard operation
appcache-webpack-plugin copied to clipboard

incomplete manifest when webpack --watch

Open gizocz opened this issue 8 years ago • 5 comments

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.

gizocz avatar Nov 14 '15 09:11 gizocz

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.

lettertwo avatar Nov 16 '15 15:11 lettertwo

@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?

spock123 avatar Dec 15 '15 13:12 spock123

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 .

gizocz avatar Dec 16 '15 12:12 gizocz

same problem here... missing all "assets" (file-loader, CopyWebpackPlugin) @--watch at build-nr >= 2

thx!

crazyx13th avatar Feb 27 '20 13:02 crazyx13th

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`)
 })
},

crazyx13th avatar Mar 02 '20 08:03 crazyx13th