-
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
fix: allow resolving package.json within packages #3413
Conversation
Enables the following type of import: const pkg = require('@mantine/core/package.json'); This is used to access the contents of package.json which is usually not exported by any of the exports within the package.json. Signed-off-by: Christian Stewart <[email protected]>
The design of the |
@evanw So it's impossible to import package.json? Why? It's in node_modules and always present. Regardless of what the developer exported. If this isn't possible, is there any way at all to determine the root path (path to package.json parent dir) for an import? Because that seems impossible with esbuild and the above reasoning you have given seems arbitrary and unnecessarily restrictive. Who does esbuild serve? The developer, or the person who published the package?... |
The reason esbuild does this is because it tries to follow already-established specifications and community conventions to have better interoperability with other tools. In this case the node team is the one who created the
According to the specification for |
@evanw I understand the reasoning and the link you provided helps to clarify the situation quite a bit, thanks. |
Enables the following type of import:
This is used to access the contents of package.json which is usually not exported by any of the exports within the package.json.
Reproduction of the issue:
Importing package.json currently works with some packages (like
react
) but not others (like@mantine/core
).