Latest server.js code breaks HDR
paulhmorris opened this issue · 1 comments
paulhmorris commented
Have you experienced this bug with the latest version of the template?
Yes
Steps to Reproduce
npx create-remix@latest --template remix-run/blues-stack
npm run build
npm run dev
In root.tsx
, log anything in the loader to trigger HDR
export const loader = async ({ request }: LoaderFunctionArgs) => {
const data = {
foo: "bar",
foo2: "bar2",
};
console.log(data);
return json({ user: await getUser(request) });
};
// Logs nothing on HDR
Nothing is logged. Stop the dev process and restart --> now the data is logged.
Comment out a line of the object and save
const data = {
foo: "bar",
// foo2: "bar2",
};
console.log(data);
// still logs { foo: 'bar', foo2: 'bar2' } from previous file state
The updated object is not logged. The console indicated that hmr + hdr ran. Even declaring the object outside the loader doesn't resolve it.
Using the server.ts
from before #221 resolves the issue, but I don't know enough about what's going on to give any more helpful info.
Thanks!
Expected Behavior
Changing code inside loaders or used inside loaders should rerun loaders with new code.
Actual Behavior
Changing code inside loaders or used inside loaders does not rerun loaders with new code, and a full server restart is required to see changes.