-
Notifications
You must be signed in to change notification settings - Fork 37
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
When using esbuild plugin, import-is-undefined warning raised #471
Comments
Thanks for the investigation. You are right that this needs to be solved with a bit more elaborate solution - I hacked this together. Honestly adding a file parser isntt too crazy imo. It's a build tool so whatever. |
I'm also hitting this. |
I'm also hitting this, creating a lot of spam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Steps to Reproduce
If the file that is the entry point does not have a default export, an import-is-undefined warning will be raised at build time.
Cause of the issue
When injecting the stubs, the original module defaults are exported, which is the cause of this issue.
sentry-javascript-bundler-plugins/packages/esbuild-plugin/src/index.ts
Lines 100 to 101 in 4d123db
Proposed amendment
I think it needs to be determined if the module has a default export.
There are two possible ways to do that.
Use dynamic import
It is possible to determine if a module has a default export by defining a function like the following.
However, there is a problem with this: it may affect the build if the module has side effects.
Use AST parser
By using the AST parser as shown below, it is possible to determine if a module has a default export.
However, it seems excessive to introduce an AST parser just to solve this issue.
The text was updated successfully, but these errors were encountered: