-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack resolves browser package module by default #138
Comments
whoa, wtf! good to know. ANY dependency with 'browser' field will cause this? maybe we should add |
Pretty much :) They are not meant for Node. There is also a |
I can make a PR, if you think this wont break people's code (which I dont think it should). |
pr welcome. this is unfortunately just a result of us using webpack for something it wasn't strictly designed to do |
fixed problem for me! |
glad to hear. if you can think of a way to build it into netlify lambda i am all ears. this one seems nasty. |
We just need to tweak the default config. I had forgotten about this, will see what can be done :) |
OK so I am writing this so other people dont waste hours like me.
Issue
Your function works when you manually tested and with simple express server, but throws errors in both
serve
andbuild
modes of netlify-lambda.Possible Cause
It may be that one of the dependencies has a
browser
field defined in itspackage.json
(could be indirect dep), which in most cases is not compatible with Node, but Webpack by default prefers it overmain
ormodule
definitions.Solution
Create a
webpack.functions.js
file in with a modified resolver, so it skips the browser bundleThen run your command
The text was updated successfully, but these errors were encountered: