[BUG] Updating to 1.4.3 breaks production build with Vite rollup error
See original GitHub issueDescribe the bug I updated to @shopify/hydrogen 1.4.3 from 1.4.2., and I’m getting the following error on production builds via Github Actions:
$ shopify hydrogen build --target node
[STARTED] Building node code
vite v2.9.15 building SSR bundle for production...
transforming...
✓ 38 modules transformed.
[vite]: Rollup failed to resolve import "/app/dist/client/index.html?raw" from "node_modules/@shopify/hydrogen/dist/esnext/platforms/virtual.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
[FAILED] [vite]: Rollup failed to resolve import "/app/dist/client/index.html?raw" from "node_modules/@shopify/hydrogen/dist/esnext/platforms/virtual.js".
[FAILED] This is most likely unintended because it can break your application at runtime.
[FAILED] If you do want to externalize this module explicitly add it to
[FAILED] `build.rollupOptions.external`
━━━━━━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[vite]: Rollup failed to resolve import "/app/dist/client/index.html?raw" from "node_modules/@shopify/hydrogen/dist/esnext/platforms/virtual.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
To Reproduce
- Create a production build, in my case, via Github Actions using
ubuntu-latestas the build container.
Additional context Add any other context about the problem here. eg.
- Hydrogen version: 1.4.3
- Docker image:
ubuntu-latest
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
[BUG] Updating to 1.4.3 breaks production build with Vite ...
The only thing that changes from 1.4.2 to 1.4.3 is some ... It should be created during the build but before throwing this...
Read more >production build broken in Vite · Issue #5035 - GitHub
Was looking into this and this looks like an issue with vite js using roll-up plugin and hasn't been fixed yet, the recommended...
Read more >Troubleshooting - Vite
Syntax Error / Type Error happens Vite cannot handle and does not support code that only runs on non-strict mode (sloppy mode). This...
Read more >vite failed to fetch dynamically imported module - You.com
One attempt to fix this issue, try to catch the error and force a reload to refetch the resource, but make sure to...
Read more >How do I fix the npm UNMET PEER DEPENDENCY warning?
UNMET PEER DEPENDENCY error is thrown when the dependencies of one or more modules specified in the package.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It turns out the issue was with outdated
shopify clipackages… Updating solved the build issue 👍I’m now wrestling with a package from Builder.io that is causing some errors (but this is probably unrelated to hydrogen).
Thanks for the help getting through the build issue 🙏
The only thing that changes from 1.4.2 to 1.4.3 is some implementation details of the Cart component so this might not be related to the version. Can you try using Node 18 and making sure
node_modulesis not cached? Also, can you check if/app/dist/client/index.htmlfile exists after this error? It should be created during the build but before throwing this error.