Skip to content
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

Allow module field #5460

Closed
wants to merge 1 commit into from
Closed

Allow module field #5460

wants to merge 1 commit into from

Conversation

PepijnSenders
Copy link
Contributor

@PepijnSenders PepijnSenders commented Feb 5, 2018

At the moment jest always resolves dependencies through the main field in the package.json. This PR will allow packages to also be imported through the module field.

Why is this needed?

According to the new module field proposal node.js will start preferring module to main.

Real world example

I have a project where I depend heavily on yarn workspaces. I use the module and the main field to distinguish between compiled and non-compiled files. So the module field actually refers to the actual source code of the required dependency. When it would just require the main field it would load the compiled files, which would make it harder to debug around different packages.

@PepijnSenders
Copy link
Contributor Author

So I just noticed in my own project, that this will fail with some packages. Webpack is able to do this right, maybe we can steal the idea on how to do it from them.

@SimenB
Copy link
Member

SimenB commented Feb 5, 2018

Thanks for sending a PR! See #2704 for a longer discussion, and more code 🙂I'd suggest copying that approach, rebase it, and se where we're at.

@cpojer
Copy link
Member

cpojer commented Feb 7, 2018

Agreed, reviving #2704 is probably the best idea :)

@PepijnSenders
Copy link
Contributor Author

Seems like that PR is a lot further than this one, yes.

@PepijnSenders
Copy link
Contributor Author

I reopened the old PR here: #5485

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants