webpack-hot-server-middleware: Dynamically / lazily loaded chunks throw an error
Hello, I’m trying to implement this with Angular2. Everything seems to be working fine client side, but SSR is not working with “lazy-loaded” chunks Error: Cannot find module './0.server.js'
.
I tried using LimitChunkCountPlugin
but the rabbit hole seemed to be deeper. Now I looked at the MemoryFileSystem
and the file is definitely there.
Eventually I got it to work, but I had to run a build before running the server, which is weird, it seems like it needs the disk files to be there before starting, but it still uses the memory files. I know it doesn’t use disk files because deleting their content doesn’t change the outcome, and changes to /src
files (i.e. rebuilding) doesn’t change them, however, if I delete the file from disk, it bugs out again. 😕
Here’s the branch I’m working on https://github.com/S-Intelligent-Technologies/sit-ngx-starter/tree/fm-better-hmr
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 18 (1 by maintainers)
I think I get a similar error when I import my files dynamically It works fine with a static import:
import ExploreView from './containers/ExploreView'
but with a dynamic import:
(I’m investigating clearing the require cache after compile as an alternative solution)