It works fine with Rollup, but on Webpack the page gets rebuilt on change but then you have to manually refresh the browser if you want to load the changes.
Also seeing this, with the following error logged to the console:
Uncaught TypeError: Cannot read property 'status' of undefined
at check (sapper-dev-client.js:6)
at EventSource.source.onmessage (sapper-dev-client.js:37)
I was also having this problem on webpack (when it worked just fine with rollup), but I eventually found that if I manually disabled hot module reloading then sapper will enable live reloading instead and everything seems to work as expected.
So I have changed yarn dev to execute sapper dev --no-hot.
Well I've first found this same issue in the template repo sveltejs/sapper-template#153 but I believe the issue seems to be with sapper internal code itself, and no one seems to actually try to fix he issue instead of simply disabling hot reloading...
Maybe these are helpful:
https://github.com/rixo/sapper-template-hot#webpack
https://github.com/sveltejs/svelte/issues/3632
How has this not been solved?
Any update on this?
At least update the Webpack template to include --no-hot.
I am getting this error with horReload option disabled:
Uncaught TypeError: Cannot read property 'status' of undefined
at check (sapper-dev-client.js:6)
at EventSource.source.onmessage (sapper-dev-client.js:37)
Well very long since I last visited this issue but there is even webpack 5 now...
We're more likely to drop webpack support than implement webpack 5 at this point, so I wouldn't hold your breath.
@antony OK, lets just use nuxt.js then.
nuxt.js is another excellent option for building PWAs
Well, as it stands the webpack implementation is simply broken. Shouldn't it be removed from the README.md?
as an alternative, somebody from the community who has expertise in webpack could help us fix it, or migrate to webpack 5 perhaps?
This may be somewhat off-topic, but what is the benefit of offering two different bundlers? If there's a compelling reason to keep offering webpack I'd be happy to look into this, but if we could simplify things at no cost by just dropping webpack it's probably not worth the effort.
There is a PR pending for webpack 5 support in svelte-loader: https://github.com/sveltejs/svelte-loader/pull/136
Most helpful comment
I was also having this problem on webpack (when it worked just fine with rollup), but I eventually found that if I manually disabled hot module reloading then sapper will enable live reloading instead and everything seems to work as expected.
So I have changed
yarn devto executesapper dev --no-hot.