Replies: 9 comments 22 replies
-
The team is still optimizing the new dev server. Couple things to try:
Make sure you're not double-purging with incorrectly configurated |
Beta Was this translation helpful? Give feedback.
-
after some digging in, I found some interest things. I'm using ESM module format. and there is a dependency, let's call it import { TUXProvider } from 'tux';
export default function Index() {
return <TUXProvider>Hello</TUXProvider>;
} the entry file of export { TUXProvider } from './components/TUXProvider/TUXProvider.js'
export { TUXButton } from './components/TUXButton/TUXButton.js'
// and so on, 1000 more lines. the file is pretty big, but it is tree shakeable. I changed my code export default function Index() {
return <div>Hello</div>;
} the rebuilding only takes like 200~300ms. I tried to import it with full path, import { TUXProvider } from 'tux/dist/components/TUXProvider/TUXProvider.js';
export default function Index() {
return <TUXProvider>Hello</TUXProvider>;
} but the build failed. SyntaxError: Named export 'TUXProvider' not found. The requested module 'tux/dist/components/TUXProvider/TUXProvider.js' is a CommonJS module, which may not support all module.exports as named exports. |
Beta Was this translation helpful? Give feedback.
-
comparing to my other remix project which is not using HMR and got more dependencies. the rebuilding only take like 1s. |
Beta Was this translation helpful? Give feedback.
-
My observations:
Possible short-term action points:
Other:
|
Beta Was this translation helpful? Give feedback.
-
Could we get an official answer from the Remix team here? Seems like some clarity is due in regards to the reasoning behind this issue |
Beta Was this translation helpful? Give feedback.
-
Issue is in esbuild. It doesn't support the REAL incremental rebuilds. Every rebuild is basically from scratch. We solved this in our build process by doing the build it 2 phases:
By doing this, we can bundle our code and everything from node_modules in two separate processes. So, each change in our code will trigger just the first step of the build process which is often just a few milliseconds instead of bundling all the node_modules every time which could easily took 4~5 seconds. There are situations like adding new external dependency which could trigger the second step too but they don't happen often. |
Beta Was this translation helpful? Give feedback.
-
Happy to report that with our new Vite plugin, HMR times are vastly improved. The HMR w/ AntD that used to take ~1s on my MBP M1 Max now takes <100ms with my (lower powered) MBP M1 Pro. Anyone seeing slow rebuild times should switch to the Remix Vite plugin, which is on the cusp of being marked as stable (#8713). To reproduce, I grabbed the Vite template ( import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import { ConfigProvider } from "antd";
export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<ConfigProvider>
<Outlet />
</ConfigProvider>
<ScrollRestoration />
<Scripts />
</body>
</html>
);
} Then I hit |
Beta Was this translation helpful? Give feedback.
-
Wow, wow, wow, wow, wow, wow, Vite is..... Vite is.... Wow 🤤🤯🙏 |
Beta Was this translation helpful? Give feedback.
-
How to use vite config with server.ts but still maintain HMR? |
Beta Was this translation helpful? Give feedback.
-
why it take 4 seconds to rebuild a file? is it incremental rebuild?
Beta Was this translation helpful? Give feedback.
All reactions