Brought up by #909
When a package's "browser" field is an object, resolve.exports will return the entire object, not a string file path:
When true and "browser" is an object, then legacy() will return the the entire "browser" object.
See resolve.exports#optionsbrowser
This presents an issue in packages like bn.js:
package.json
...
"browser": {
"buffer": false
},
|
function resolveLegacyEntry(pkg, path) { |
|
const entry = |
|
_resolveLegacyEntry(pkg, { |
|
browser: true, |
|
fields: ['esmodules', 'modern', 'module', 'jsnext:main', 'browser', 'main'] |
|
}) || 'index.js'; |
|
return '/' + entry.replace(/^\.?\//, ''); |
|
} |
entry is { buffer: false }, not an import/file path. Besides the immediate issue of .replace not working, we'll need to fallback to "main" most likely.
Brought up by #909
When a package's
"browser"field is an object,resolve.exportswill return the entire object, not a string file path:See resolve.exports#optionsbrowser
This presents an issue in packages like
bn.js:wmr/packages/wmr/src/plugins/npm-plugin/resolve.js
Lines 10 to 17 in 9a6777f
entryis{ buffer: false }, not an import/file path. Besides the immediate issue of.replacenot working, we'll need to fallback to"main"most likely.