remix icon indicating copy to clipboard operation
remix copied to clipboard

Rebuild time is more than 20 seconds with large assets

Open j-palindrome opened this issue 2 years ago • 3 comments

What version of Remix are you using?

nightly

Are all your remix dependencies & dev-dependencies using the same version?

  • [X] Yes

Steps to Reproduce

Since updating an assets directory with a few larger files, Remix's build time is enormous. The assets contain two .mp4 files which are slightly bigger than 100MB. Upon removing the videos, the build time is back to normal.

What confuses me is, why is the rebuild time so consistently large when the assets are not changing? Seems like it might be some sort of issue where Remix is rewriting the videos with each build.

My config:

{
  cacheDirectory: './node_modules/.cache/remix',
  ignoredRouteFiles: ['**/.*', '**/*.test.{js,jsx,ts,tsx}'],
  serverModuleFormat: 'cjs',
  postcss: true,
  tailwind: true,
  serverDependenciesToBundle: [/^d3.*/, /^delaunator.*/, /^internmap.*/],
}

Expected Behavior

A usable build time.

Actual Behavior

I can't develop with the current rebuild times. Here is an excerpt from my Terminal:

 info  rebuilding... (~ app/components/Section.tsx)
 info  rebuilding... (~ app/components/Section.tsx)
 info  building...
The service is no longer running
 info  rebuilt (11.7s)
Remix App Server started at http://localhost:3000 (http://192.168.1.73:3000)
 info  app server ready (1.8s)
 info  hmr

 info  rebuilding... (~ app/root.tsx)
 info  rebuilding... (~ app/root.tsx)
 info  building...
The service is no longer running
 info  rebuilt (7.4s)
Remix App Server started at http://localhost:3000 (http://192.168.1.73:3000)
 info  app server ready (415ms)
 info  hmr

 info  rebuilding... (~ app/components/Section.tsx)
 info  rebuilding... (~ app/components/Section.tsx)
 info  building...
The service is no longer running
 info  rebuilding... (~ app/components/Section.tsx)
 info  rebuilding... (~ app/components/Section.tsx)
 info  building...
The service is no longer running
 info  rebuilt (23.7s)

j-palindrome avatar Aug 06 '23 05:08 j-palindrome

I think Remix needs to check the video files to ensure they're the same, so this may be taking a long time.

If the file doesn't change, why not move it to the public folder? It will not have a hashed file name, but it will keep the build times fast enough, and you can always rename the file if you change them.

sergiodxa avatar Aug 06 '23 07:08 sergiodxa

This seems possible but an unnecessary workaround. Can't Remix just check file metadata to see if it's been modified? For development purposes this seems perfectly reasonable.

j-palindrome avatar Aug 06 '23 15:08 j-palindrome

@j-palindrome I'm wondering if you're encountering the same problem with the vite compiler. Did you switch to it at some point?

machour avatar May 17 '24 13:05 machour

I did, I don't know if this is an issue because I'm not using large videos anymore, but the vite compiler is generally much better.

j-palindrome avatar May 30 '24 04:05 j-palindrome