Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update dependencies, normalize testing #607

Merged
merged 15 commits into from
Oct 1, 2024

Conversation

wiledal
Copy link
Member

@wiledal wiledal commented Jan 29, 2024

Description

  • Update some high-level dependencies
  • Update test suite dependencies location
  • Add .yarnrc.yml to support yarn 4
    • This is the recommended way to go, but not supported on Vercel, so let's skip for now

Problems with this update:

  • r3/rapier in 'independent' stepping mode, relies on requestAnimationFrame, which breaks testing when running tests outside of a browser environment
    • We solve this by running tests with the happy-dom or jsdom environment
  • New versions of three-stdlib (common dependency in all r3/* libs) has a lottiejs implementation which is optimized for ssr, and does some canvas operations immediately when run in a browser environment. This breaks tests.
    • To fix this, we can run in jsdom, and apply vitest-canvas-mock in the setup-file
  • Unfortunately, for some reason, the Vercel deployment of the demo breaks when updating any of these libraries.
    • Switching from happy-dom to jsdom breaks Vercel deployment
    • Updating vitest to the latest version breaks Vercel deployment

As I personally don't have access to the Vercel deployment logs or settings, it's nearly impossible to replicate. It's very odd that the testing suite, which is not even run on Vercel, would be affecting the deployment.

Further work is needed to make this up to date with current versions of all the dependent software.

Type of change

  • 📦 Other (tests, refactoring, docs, etc.)

Checklist:

  • 🔍 I have performed a self-review of my code
  • 🟢 All new and existing unit tests pass

Copy link

changeset-bot bot commented Jan 29, 2024

⚠️ No Changeset found

Latest commit: 2b78326

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@wiledal
Copy link
Member Author

wiledal commented Sep 19, 2024

⭐ Update
I cloned the repo and tried reproducing the issue. Out of the box, the demo does not build.
I solved it by setting the install script on Vercel to cd ../; yarn, so that the install happens on the workspace root rather than in the demo itself.

Since I don't have access to the pmndrs Vercel account, I cannot check to see what's up, but it might be related. Although it's odd how it has worked before in that case.

@drcmda, any chance you could have a look? A dump of the build error on Vercel would be nice, too.

@isaac-mason
Copy link
Member

Hey @wiledal I can help with vercel debugging!

Looks like the last build failed on this:

[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.20.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Command "yarn install" exited with 1

@isaac-mason
Copy link
Member

isaac-mason commented Sep 20, 2024

I'll try updating the node.js version in vercel and re-running 🙂

@isaac-mason
Copy link
Member

ok, now the vercel deployment is up to a new error

🎁 error @react-three/rapier An unhandled Rollup error occurred: packages/react-three-rapier/src/utils/utils-collider.ts (2:7) Error when using sourcemap for reporting an error: Can't resolve original location of error.
🎁 info If want to learn more about the above error, check https://preconstruct.tools/errors
🎁 info If the error is not there and you want to learn more about it, open an issue at https://github.com/preconstruct/preconstruct/issues/new
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn build && cd demo && npx vite build" exited with 1

@wiledal
Copy link
Member Author

wiledal commented Sep 30, 2024

Thanks @isaac-mason! I'm just back from a vacay 🌴. I'm trying to reproduce this error on Vercel on a forked repo. Could you let me know what the Vercel project's Build & Development Settings-settings are?


Edit: Ah, I think I got it now.

Preset: Other
Root Directory: <empty>

Build command: yarn build && cd demo && npx vite build
Output directory: demo/dist
Install command: yarn

Getting the same errors, will fiddle a bit to see if I can find a solution.


Edit 2: I can get this working when configuring

Preset: Vite
Root Directory: demo

Build command: <empty>
Output directory: <empty>
Install command: cd ../; yarn

It will be compiling "from source", though I'm not sure how preconstruct deals with the built packages in this context, or if it really matters... That being said, it would be great knowing why rollup fails to build packages after updating the unrelated testing suite.

@isaac-mason
Copy link
Member

I've updated the pmndrs react-three-rapier vercel app to have the same configuration now 🙂

I'm not very familiar with preconstruct either, would be good to understand.

@isaac-mason
Copy link
Member

Built and deployed successfully! https://react-three-rapier-jjahtxe68-pmndrs.vercel.app/

@wiledal wiledal merged commit 69b6e3a into main Oct 1, 2024
2 checks passed
@wiledal wiledal deleted the fix/update-dependencies-jan-2024 branch October 1, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants