Why is the use node packages on .server.ts disabled? #1368
Replies: 5 comments 3 replies
-
Hi 👋 I think the |
Beta Was this translation helpful? Give feedback.
-
That did not seem to help my issue as found in #1367 (comment) What I did was take the default and add Here's my config with this:
As mentioned in other discussion turning off "neutral" and using "node" allows node packages to run but I assume there is a reason neutral is set but cannot phantom. |
Beta Was this translation helpful? Give feedback.
-
The question is... why do I need polyfills to run server only code? I am not sure what is going on behind the scene with remix but it sounds like it blocks access to code node modules in neutral mode which would make sense to ensure this ran in a non node environment but Shopify docs seem to indicate this can run on say Vercel. I think "neutral" is intended for CloudFlare compatibility but the docs should mention this will not work with NodeJS or ideally provide the user a choice of hosting. I am not sure what Hydrogen has in terms of capabilities? |
Beta Was this translation helpful? Give feedback.
-
OK. It's fine if Ofxygen doesn;t run node- certainly alternatives like a separate API - I did see a small s3 standalone client. Docs should def mention that this though so that devs know to build their backend code separately. I usually do but was quite excited to have it all in one :). |
Beta Was this translation helpful? Give feedback.
-
Actually there is something odd going on I think. Someone here was having an issue whereas the aws-sdk was loading node modules (child_process, etc - just the ones I have issue with). The fix - for webpack - was to ensure that the loading was ['browser', 'module', 'main'] which evidently as I understand it ensured that the aws-sdk used the necessary polyfills or workaround within itself. I see that |
Beta Was this translation helpful? Give feedback.
-
The remix serverPlatform is forced to "neutral" which prevents the use of many node modules such as the aws-sdk. Since this can be hosted on platforms such as Vercel and other NodeJS capable one I am confused as to why this is not allowed. I currently have to create a standalone API just to make a simple call to AWS from server code
Beta Was this translation helpful? Give feedback.
All reactions