build: prevent Oxygen deploy OOM on large storefronts (disable prod sourcemaps + doc heap fix)#444
build: prevent Oxygen deploy OOM on large storefronts (disable prod sourcemaps + doc heap fix)#444paul-phan wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 603c75a6f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Disable sourcemaps in the production build. Sourcemap generation is a | ||
| // major memory driver and can push large storefronts past the CI runner's | ||
| // default Node heap (~2GB), causing OOM (exit 134) during Oxygen deploys. | ||
| sourcemap: false, |
There was a problem hiding this comment.
Disable server sourcemaps in Hydrogen deploys
When the Oxygen workflow uses npx shopify hydrogen deploy, this setting does not disable the expensive server sourcemap build: the installed Shopify CLI's deploy path calls its build helper with sourcemap: true, and that helper passes an inline Vite config for the SSR build (build: { sourcemap: n, ssr: ... }), which takes precedence over vite.config.ts. Large storefront deployments will therefore still generate SSR sourcemaps and can still hit the OOM this commit is meant to avoid unless the deploy uses a custom build command/flag that turns Hydrogen sourcemaps off.
Useful? React with 👍 / 👎.
603c75a to
6dbd177
Compare
Why
A client storefront built on this theme hit
FATAL ERROR: JavaScript heap out of memory(exit 134) during the Oxygen deploy. The production build peaked above the CI runner's default Node heap (~2GB), so the deploy died before uploading a complete build. The environment then served HTML referencing client JS assets that were never published, and the storefront rendered blank (alloxygen-v2/.../assets/*.jsreturned 404).To avoid other clients hitting the same wall on large storefronts, harden the base theme.
Changes
vite.config.ts—build.sourcemap: false. Sourcemap generation is a major memory driver during the production build; disabling it lowers peak memory with no runtime cost.README.md— document the heap fix (NODE_OPTIONS: --max-old-space-size=8192on the Oxygen deploy step) for storefronts large enough to still OOM. The deploy workflow is generated per-storefront by Shopify, so this can't live in the theme repo, but the note tells clients exactly where to add it.Notes
manualChunkssplitting is already present in this config and is kept.