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
Node support / node_modules and string literals #10
Comments
I'm intending esbuild to be a bundler for the web, not for node. Here's my answer for a similar question on issue #5 (comment):
I'm curious what your use case is for using a bundler with a node app. |
Compatibility and portability are the main use cases. Tree shaking is a bonus. Apologies for not seeing that. I read a few issues but missed that. Thanks for the quick response! |
Unfortunately, many packages include node packages but don't use them (Node & Browser compatible). Which is why other bundler like webpack show a warning instead of an outright error. Could this be made so that it shows an error and returns the missing node modules as undefined? |
Yes, I would like to do this. I will likely add a context parameter so you can configure whether your build is targeting the browser or node, and modify the behavior of this feature depending on context. |
I just added some basic support for this via |
Another interesting pattern to possibly support is |
Hey, nice project.
Is this node compatible? I am guessing not:-
I gave my app a test build but it's failing every time with
error: The argument to require() must be a string literal
The above error originates from libraries within
node_modules
directory.To test if I could get past these errors, I changed to string literals in the lib and it still results in the same error.
The text was updated successfully, but these errors were encountered: