epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.21k stars 348 forks source link

Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep) #790

Open andrecasal opened 2 weeks ago

andrecasal commented 2 weeks ago

The error Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep) shows on first load. I looked at Vite's repo for potential issues, but didn't find any directly related issues, so I'm checking here first. Where do you think this error might be coming from @kentcdodds?

Steps to reproduce:

  1. git clone https://github.com/epicweb-dev/epic-stack
  2. code epic-stack
  3. npm i
  4. npm run setup
  5. npm run dev
  6. npm run test:e2e

Run all tests in Playwright and notice the Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep) error on almost every test. You can also quickly navigate pages to the same effect. Notice running the tests twice (or reloading the page) makes the issue go away.

To reproduce from here just delete Vite's cache:

  1. Delete node_modules
  2. npm i
  3. npm run dev
  4. npm run test:e2e and run the tests again

    System: OS: macOS 14.5 CPU: (12) arm64 Apple M2 Pro Memory: 131.36 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.11.0 - /usr/local/bin/node npm: 10.2.4 - /usr/local/bin/npm pnpm: 8.15.6 - ~/Library/pnpm/pnpm bun: 1.0.25 - ~/.bun/bin/bun Browsers: Brave Browser: 126.1.67.123 Chrome: 126.0.6478.127 Edge: 123.0.2420.65 Safari: 17.5

kentcdodds commented 2 weeks ago

This is an annoying thing from vite because they compile things on demand to make it faster to start up. I'm not sure whether there's a way around this. I welcome any tips!

andrecasal commented 2 weeks ago

Adding all dependencies to optimizeDeps.include pre-bundles everything and the tests pass on first run and I don't see any perceivable delay in startup time.

But I'm not sure keeping track and adding dependencies manually to the array is something we want 🤔

kentcdodds commented 2 weeks ago

We could just have the include match everything 🤷‍♂️