-
-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
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
trueand"browser"is an object, thenlegacy()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
},wmr/packages/wmr/src/plugins/npm-plugin/resolve.js
Lines 10 to 17 in 9a6777f
| 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.
Metadata
Metadata
Assignees
Labels
No labels