goldhand/sw-precache-webpack-plugin

Can't start webpack-dev-server with 0.11.2 plugin version: (TypeError: this[(fn + "Sync")] is not a function)

Closed this issue · 3 comments

[*] I'm submitting a bug report

webpack version:
2.2.1

sw-precache-webpack-plugin version:
0.11.2

Please tell us about your environment:
Linux

Current behavior:
Can't start webpack-dev-server with lastest plugin version, but OK with previous (v0.11.0).

Error message:

TypeError: this[(fn + "Sync")] is not a function
    at MemoryFileSystem.(anonymous function) (/home/Archive/node_modules/webpack-dev-middleware/node_modules/
memory-fs/lib/MemoryFileSystem.js:279:34)
    at /home/Archive/node_modules/sw-precache-webpack-plugin/lib/index.js:237:25
    at /home/Archive/node_modules/sw-precache-webpack-plugin/lib/index.js:236:18
    at SWPrecacheWebpackPlugin.writeServiceWorker (/home/Archive/node_modules/sw-precache-webpack-plugin/lib/
index.js:250:14)
    at /home/Archive/node_modules/sw-precache-webpack-plugin/lib/index.js:96:24
  • Webpack configuration:
		plugins.push(
			new SWPrecacheWebpackPlugin({
				cacheId: 'app'
				, entry: path.join(sourcePath, './sw.js')
				, filename: './sw.js'
				, maximumFileSizeToCacheInBytes: 1024 * 800 
				, mergeStaticsConfig: true
				, minify: false
				, runtimeCaching: [{
					handler: 'cacheFirst'
					, urlPattern: /(.*?)/
				}]
			})
		);

This plugin will not work with webpack-dev-server so I would just remove it from your dev config.

But it's troubling that there is an error. It looks like the source is @rkostrzewski promisify function

Do we need a Promise polyfill maybe? @rkostrzewski I don't think we need the promisfy function, maybe we can just remove it.

@Mrmaxmeier send that pr over 😄 just tested its working

Thanks!