Open indexzero opened 6 years ago
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'] })
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:However, in the absence of
"module"
I would like to fall-back to"browser"
. This is handled in webpack land asresolve.mainFields
.Is there interest in this feature? Does it already exist and I overlooked it in the code?