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

"resolve.mainFields"-like support #91

Open
indexzero opened this issue Jun 28, 2018 · 1 comment
Open

"resolve.mainFields"-like support #91

indexzero opened this issue Jun 28, 2018 · 1 comment

Comments

@indexzero
Copy link

Was deep in the bowels of a large webpack.config.js file and came across a challenge that this package seems perfect for solving – with one kinda catch.

That is: nearly all of the time I want to resolve against "module", which I can believe is possible this way after reading the docs:

resolve.sync('@scope/my-module', { browser: 'module' });

However, in the absence of "module" I would like to fall-back to "browser". This is handled in webpack land as resolve.mainFields.

Is there interest in this feature? Does it already exist and I overlooked it in the code?

p.s. long-time no speak. Hope you are well.

@indexzero
Copy link
Author

In the meantime I realized I can accomplish this with packageFilter:

resolve.sync('@scope/my-module', {
  browser: 'module',
  packageFilter: pkg => {
    pkg.module = pkg.module || pkg.browser;
    return pkg;
  }
});

Leaving this issue open since the proposed syntax is a little more obvious:

resolve.sync('@scope/my-module', { browser: ['module', 'browser'] })

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

No branches or pull requests

1 participant