-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Panic when using subpath imports for bundled browser build #3067
Comments
Please provide a self-contained way to reproduce the issue. |
https://github.com/znewsham/test-esbuild
|
Thanks for the report. This crash happens as esbuild is attempting to generate a helpful error message for this bad subpath import. The error message should be:
This crash will be fixed in the next version of esbuild. In the meantime, the workaround is to fix the incorrect import path. |
Ah, that's unfortunate - I guess esbuild isn't compatible with this form of resolution? This doesn't seem to match up with esbuild's behaviour of relative paths. For example, if I were to import |
As I re-read your comment - I think I understand, on the server I use an experimental flag to support this (and in future versions of node will need to use a custom loader) |
The problem is that the behavior of the
|
Oh very interesting - I guess I never got this far. It seems there is no way around this - the problem I was trying to solve is converting a legacy codebase and I didn't want to have to convert all my Maybe I just bite the bullet and convert the damn things. Thanks for looking! |
I'm trying to use node's subpath imports syntax as follows to get around the issue of absolute imports not being relative to the project root (the reason for using the subpath isn't super relevant). Somewhat confusingly the path I'm trying to import is
/imports
- which I use#imports/*
to represent. Note - I've already checked #2913 - I don't think it's relevant as I'm already on 0.17.17This works just fine when doing a server build - but not when doing a client build. Both use the
bundle
option (however the server build does do some very custom queueing work). On the client build I get the following error:The triggering import (in
client/main.ts
) looks like this:Interestingly, if I change the import to
#imports/startup/index.ts
- it works - Note: index.ts is required -#imports/startup/index
fails with a different error.The arguments I'm passing to esbuild are as follows (abridged)
The text was updated successfully, but these errors were encountered: