-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Closed
Description
Bug report
When working with next and a linked module, the hot reloading doesn't work on the server but only on the client.
Describe the bug
When you have a linked module inside the node_modules folder the module is only replaced on the client but not on the server. This means that you have to restart the whole next application in order to render the updated module on the server.
When the module is a React.Component and the output change this even results in inconsistent rendering between server and client shown in a error message in the console.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Setup clean next-js app
- Link a module via
npm link my-module - Import the module anywhere e.g.
pages/index - Start next-js in dev mode
- Change your linked module e.g. add
console.logor ifReact.Componentchange render method. this will trigger a reload (see terminal) - Changes are only visible in the client. server still loads the previous version of the module (probably from cache)
Expected behavior
The require.cache gets cleared properly so the linked module will be re-required also on the server. so client and server stay in sync.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels