"Resolve" plugin api return path when browser `{"module":false}`
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
### Case
About package `object-inspect` which has browser config in package.json.
```json
{
"browser": {
"./util.inspect.js": false
},
}
```
When use bundler will correctly return empty in [bundler](https://github.com/evanw/esbuild/blob/73a539d1a597f9a7bb933b125a47479de4e246fb/internal/bundler/bundler.go#L897), but in plugin resolve api that return path liked `node_modules/.pnpm/object-inspect@1.12.0/node_modules/object-inspect/util.inspect`.
In this case, I use the resolve result to load file but failed.
From developer‘s point of view, need to solve browser module false case by self, or just ignore load fails.
### What is expected
In `enhanced-resolve`, this case with `object-inspect` return path as `false`, that easily to decide and understand.
May esbuild do the same return?
### Other Information
esbuild version: 0.14.23
Relative PR: https://github.com/evanw/esbuild/pull/1881
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the plugin resolve API and compare its behavior with the browser-field handling shown in internal/bundler/bundler.go. Reproduce the object-inspect package.json case using the resolve result, then verify that a browser mapping to false is represented consistently and that the plugin-loading scenario reaches the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100