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

bump remix and vite #2784

Merged
merged 29 commits into from
Mar 20, 2025
Merged

bump remix and vite #2784

merged 29 commits into from
Mar 20, 2025

Conversation

wizardlyhel
Copy link
Contributor

@wizardlyhel wizardlyhel commented Feb 27, 2025

WHY are these changes introduced?

  • Bumps Remix to 2.16.1-pre.2
  • Bumps vite from 5 to 6
  • Bump @vitejs/plugin-react for vite compatibility
  • Bump @vanilla-extract/vite-plugin for vite compatibility

WHAT is this pull request doing?

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

This comment has been minimized.

Copy link
Contributor

shopify bot commented Mar 12, 2025

Oxygen deployed a preview of your hl-bump-remix-vite branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment March 20, 2025 5:24 PM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment March 20, 2025 5:23 PM
classic-remix ✅ Successful (Logs) Preview deployment Inspect deployment March 20, 2025 5:24 PM
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment March 20, 2025 5:23 PM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment March 20, 2025 5:23 PM

Learn more about Hydrogen's GitHub integration.

Copy link
Contributor

@blittle blittle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! A few questions:

  1. What are the implications for people making this change? Is upgrading just bumping the versions in package.json? Or are there other things that they must do?

  2. Will the CLI still work with older versions of Vite? Or does upgrading Hydrogen to this release mean that they must also upgrade Vite?

@wizardlyhel
Copy link
Contributor Author

What are the implications for people making this change? Is upgrading just bumping the versions in package.json? Or are there other things that they must do?

No project code needs to be updated aside from the version bump

Will the CLI still work with older versions of Vite? Or does upgrading Hydrogen to this release mean that they must also upgrade Vite?

That's a good question .. for sure the importVite will break but that should be an easy fix since we have vite's package json. But for the miniOxygen update .. I'll have to test to find out

@wizardlyhel
Copy link
Contributor Author

Yea @blittle This is a breaking change. We will have to update minimum dependency on Remix, vite, and cli. Otherwise, it will break when people tries to run vite 5 project on latest cli.

@wizardlyhel
Copy link
Contributor Author

Oh wait! I correct myself. If projects on vite 5 somehow updates cli, as long as we fix the importVite function. It will operate fine. This is because the mini-oxygen changes won't impact until dev bumps their project to the latest with the vite 6 changes. So what we need to make sure is the minimum peer dependencies are updated properly between mini-oxygen, and remix. CLI is the only package that needs to be flexible

Copy link
Contributor

@frandiox frandiox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just added a couple of comments.

I pictured this update as part of moving from Remix to React Router. I guess that's not the case yet? When that time comes, there's some code to remove related to Remix classic bundler in our CLI.

runtime.moduleCache.invalidateDepTree([
// Module IDs are absolute from root
update.path.replace(/^\.\//, '/'),
...(update.ssrInvalidates ?? []),
]);
runtime.import(update.acceptedPath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could lead to tricky bugs in HMR. I would encourage testing HMR in different situations and see if something fails (both server and browser code).
Not saying this change is not correct, but this area was tricky to get right so it would be better to double check (if you haven't yet).

Copy link
Contributor Author

@wizardlyhel wizardlyhel Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm .. you are right about this. However, HMR still works .. just that it runs multiple times.

If it was an edit from the skeleton template, the hot reload got triggered about 3-4 times.

If it was an edit from the hydrogen-react package, the hot reload got triggered multiple times -- browser page crashes due to not being able to find modules at some point during a HMR update ping and then recovers itself after another reload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to get around this since runtime.moduleCache.invalidateDepTree completely disappears from Vite 6 because they said it was redundant.

@wizardlyhel
Copy link
Contributor Author

wizardlyhel commented Mar 17, 2025

@frandiox RR7 migration is coming up next. We have to get v3_routeConfig turned on in this PR #2722 and bumping vite so happen to be part of process

@wizardlyhel
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @wizardlyhel! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/cli-hydrogen": "0.0.0-snapshot-20250318154141",
"@shopify/hydrogen": "0.0.0-snapshot-20250318154141",
"@shopify/hydrogen-codegen": "0.0.0-snapshot-20250318154141",
"@shopify/mini-oxygen": "0.0.0-snapshot-20250318154141",
"@shopify/remix-oxygen": "0.0.0-snapshot-20250318154141"

Create a new project with all the released packages running npm create @shopify/hydrogen@<snapshot_version>
To try a new CLI plugin version, add @shopify/cli-hydrogen as a dependency to your project using the snapshot version.

@wizardlyhel
Copy link
Contributor Author

Found a bug parsing css files

Screenshot 2025-03-18 at 8 59 19 AM

@wizardlyhel
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @wizardlyhel! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/cli-hydrogen": "0.0.0-snapshot-20250319224903",
"@shopify/hydrogen": "0.0.0-snapshot-20250319224903",
"@shopify/hydrogen-codegen": "0.0.0-snapshot-20250319224903",
"@shopify/mini-oxygen": "0.0.0-snapshot-20250319224903",
"@shopify/remix-oxygen": "0.0.0-snapshot-20250319224903"

Create a new project with all the released packages running npm create @shopify/hydrogen@<snapshot_version>
To try a new CLI plugin version, add @shopify/cli-hydrogen as a dependency to your project using the snapshot version.

@wizardlyhel
Copy link
Contributor Author

wizardlyhel commented Mar 19, 2025

@frandiox I fixed the CSS parsing issue. It turns out we didn't need any of the HMR hooks anymore in vite 6. Remove the HMR hooks in the mini-oxygen vite plugin, the css parsing error also goes away.

@wizardlyhel
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @wizardlyhel! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/cli-hydrogen": "0.0.0-snapshot-20250320155609",
"@shopify/hydrogen": "0.0.0-snapshot-20250320155609",
"@shopify/hydrogen-codegen": "0.0.0-snapshot-20250320155609",
"@shopify/mini-oxygen": "0.0.0-snapshot-20250320155609",
"@shopify/remix-oxygen": "0.0.0-snapshot-20250320155609"

Create a new project with all the released packages running npm create @shopify/hydrogen@<snapshot_version>
To try a new CLI plugin version, add @shopify/cli-hydrogen as a dependency to your project using the snapshot version.

@wizardlyhel
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @wizardlyhel! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/cli-hydrogen": "0.0.0-snapshot-20250320172256",
"@shopify/hydrogen": "0.0.0-snapshot-20250320172256",
"@shopify/hydrogen-codegen": "0.0.0-snapshot-20250320172256",
"@shopify/mini-oxygen": "0.0.0-snapshot-20250320172256",
"@shopify/remix-oxygen": "0.0.0-snapshot-20250320172256"

Create a new project with all the released packages running npm create @shopify/hydrogen@<snapshot_version>
To try a new CLI plugin version, add @shopify/cli-hydrogen as a dependency to your project using the snapshot version.

@wizardlyhel wizardlyhel merged commit 0425e50 into main Mar 20, 2025
12 checks passed
@wizardlyhel wizardlyhel deleted the hl-bump-remix-vite branch March 20, 2025 21:38
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.

4 participants