Better logging of Node package build errors #2675
davidwilliford99
started this conversation in
Ideas + Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A General Issue
The package "<package_name>" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
In Hydrogen, I am often having to debug for use of native node dependencies. I understand that Hydrogen is meant to be deployed on Oxygen & not Node, but the lack of native node dependencies causes limitations with development using many popular npm packages, that utilize these native node dependencies.
Since a lot of popular libraries utilize these native node dependencies, I am often limited to trying to find some obscure library that doesn't use them, or find patchy work-arounds using polyfills and aliases.
Example Ouptut with 'http' dependency
Here is an example of the output when a native node dependency is used in an external dependency
This is an error that only shows on build. So you can be developing all day, with everything going fine. Then the next day you run your Hydrogen app & this error will magically pop up.
Things that could help:
Making the error also include the file and specific import used to trigger this native node dependency
Adding more node native packages to the Oxygen environment (a task for Shopify themselves)
If you NEED to use a native Node dependency
I have ran into this issue with the
buffer
package before.I solved it by
npm install buffer
buffer-polyfill
inpackage,json
Beta Was this translation helpful? Give feedback.
All reactions