Skip to content

Fix vite 6 resolve conditions#2863

Merged
juanpprieto merged 3 commits intomainfrom
juanpprieto/vite-6-conditions
Apr 15, 2025
Merged

Fix vite 6 resolve conditions#2863
juanpprieto merged 3 commits intomainfrom
juanpprieto/vite-6-conditions

Conversation

@juanpprieto
Copy link
Contributor

@juanpprieto juanpprieto commented Apr 15, 2025

Replaces #2840
closes #2858


Context:
https://shopifypartners.slack.com/archives/C02F94JC3QC/p1743413107901139
sanity-io/hydrogen-sanity#116
sanity-io/visual-editing#1085

Vite 6 (2025.1.3+) seems to have a different more strict NPM module resolution logic for worker exports. This PR aims to fix this by adding an additional resolve conditions for workers in the SSR option.

@github-actions

This comment has been minimized.

@shopify
Copy link
Contributor

shopify bot commented Apr 15, 2025

Oxygen deployed a preview of your juanpprieto/vite-6-conditions branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment April 15, 2025 5:01 PM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment April 15, 2025 5:01 PM
custom-cart-method ❌ Error (Logs) - Inspect deployment April 15, 2025 6:00 PM
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment April 15, 2025 5:01 PM
classic-remix ✅ Successful (Logs) Preview deployment Inspect deployment April 15, 2025 5:01 PM

Learn more about Hydrogen's GitHub integration.

@juanpprieto
Copy link
Contributor Author

/snapit

@juanpprieto juanpprieto changed the title Juanpprieto/vite 6 conditions Fix vite 6 resolve conditions Apr 15, 2025
@github-actions
Copy link
Contributor

🫰✨ Thanks @juanpprieto! 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-20250415170037",
"@shopify/hydrogen": "0.0.0-snapshot-20250415170037",
"@shopify/mini-oxygen": "0.0.0-snapshot-20250415170037"

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.

@juanpprieto juanpprieto requested a review from blittle April 15, 2025 18:14
@juanpprieto juanpprieto merged commit e7db0a5 into main Apr 15, 2025
12 checks passed
@juanpprieto juanpprieto deleted the juanpprieto/vite-6-conditions branch April 15, 2025 19:44
@balazsbajorics
Copy link
Contributor

👍

@Lms24
Copy link

Lms24 commented Apr 29, 2025

@juanpprieto Any chance this broke Vite 5 users? We have a hydrogen E2E test application that's still built with Vite 5 and @shopify/mini-oxygen@3.2.1 broke the build:

╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  The requested module 'vite' does not provide an export named                │
│  'defaultClientConditions'                                                   │
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at 3_/node_modules/ (shopify/mini-oxygen/dist/vite/plugin.js:1)           │
│    at _instantiate (node:internal/modules/esm/module_job:146)                │
│    at run (node:internal/modules/esm/module_job:229)                         │
│    at import (node:internal/modules/esm/loader:473)                          │
│    at async loadConfigFromBundledFile (e2e-tests/test-applications/remix-hy  │
│    drogen/node_modules/.pnpm/vite@5.4.18_@types+node@22.15.3_lightningcss@1  │
│    .29.3/node_modules/vite/dist/node/chunks/dep-DbT5NFX0.js:66908)           │
│    at loadConfigFromFile (e2e-tests/test-applications/remix-hydrogen/node_m  │
│    odules/.pnpm/vite@5.4.18_@types+node@22.15.3_lightningcss@1.29.3/node_mo  │
│    dules/vite/dist/node/chunks/dep-DbT5NFX0.js:66749)                        │
│    at async getViteConfig                                                    │
│    (e2e-tests/test-applications/remix-hydrogen/node_modules/.pnpm/@shopify+  │
│    cli@3.78.2/node_modules/@shopify/cli/dist/chunk-VBX7R3AF.js:140962)       │
│    at all                                                                    │
│    at async runBuild                                                         │
│    (e2e-tests/test-applications/remix-hydrogen/node_modules/.pnpm/@shopify+  │
│    cli@3.78.2/node_modules/@shopify/cli/dist/index.js:211874)                │
│    at run (e2e-tests/test-applications/remix-hydrogen/node_modules/.pnpm/@s  │
│    hopify+cli@3.78.2/node_modules/@shopify/cli/dist/index.js:211847)         │
│    at _run                                                                   │
│    (e2e-tests/test-applications/remix-hydrogen/node_modules/.pnpm/@shopify+  │
│    cli@3.78.2/node_modules/@shopify/cli/dist/chunk-QAKYKTFV.js:175008)       │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Btw, we purposefully don't use a lockfile so this is likely not an issue that too many people run into. Just wanted to let you know anyway :)

Lms24 added a commit to getsentry/sentry-javascript that referenced this pull request Apr 29, 2025
…6158)

Seems like `@shopify/mini-oxygen@3.2.1` breaks something. I somewhat
suspect that they bumped a vite version but I didn't find a changelog
yet

This should unblock the PRs we want to include in Today's release

Update: Shopify/hydrogen#2863 likely caused this
juanpprieto added a commit that referenced this pull request Sep 17, 2025
* Update resolve conditions for vite 6
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.

ReferenceError: process is not defined when using Shapediver

3 participants