Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Allow the mainFields option #4

Closed
wants to merge 8 commits into from
Closed

Conversation

crubier
Copy link

@crubier crubier commented Oct 17, 2019

Allow to use things like mainFields: ['module', 'main'] in options

See issue: #2

@arcanis
Copy link
Owner

arcanis commented Oct 18, 2019

Hey @crubier, thanks for working on this! I'd prefer to avoid reimplementing the whole resolution, so that this plugin can focus on the PnP part (ie transforming lodash into /path/to/lodash, but not the file itself). Otherwise we would have to use the same file loading mechanisms as the rest of Rollup, etc.

What do you think of this alternative approach?

This way I think that the "main field" resolution will be handled by Rollup's core, which will be less work for us! Does that sound like a plan?

@crubier
Copy link
Author

crubier commented Oct 19, 2019

I agree I am not proud of this MR. I definitely reinvented the wheel in the last few commits, but I just really needed to get this to work quickly for my internal tools (and it does work).

Your idea sounds great, but I don't totally see what I should do to put it in application right now. I will give it a try asap though. I understand that I can access rollup's own functions (aka hooks) from the this object in the plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants