aspect-build / aspect-build/rules_esbuild

[Bug]: Upgrading from v0.16.0 to v0.18.0 causes non-browser scripts to throw an error

Open
#194 3 comments 3 reactions 0 assignees View on GitHub
bug need: more info
Dominant language
Starlark
Stars
35
Forks
45
Avg merge
1d 1h
Merged PRs (30d)
1

Description

### What happened?

I am upgrading `aspect_rules_esbuild` from version `v0.16.0` to `v0.18.0`. Everything is working in v16 however in v18 I am getting the following errors from esbuild. (I couldn't check v0.17.0 because its not in the bazel registry)

```
✘ [ERROR] Could not read from file: /.../bin/node_modules/.aspect_rules_js/object-inspect@1.13.1/node_modules/object-inspect/util.inspect

node_modules/.aspect_rules_js/object-inspect@1.13.1/node_modules/object-inspect/index.js:68:26:
68 │ var utilInspect = require('./util.inspect');`
```

This happens because the object-inspect [main file](https://github.com/inspect-js/object-inspect/blob/main/index.js#L68) is requiring the file that is marked as [non-browser](https://github.com/inspect-js/object-inspect/blob/main/package.json#L81-L83).

This dependency is sadly commonly used in multiple packages such as `react-dev-utils`, `cypress` or `webpack`

### Version

Development (host) and target OS/architectures:
Linux 5.15.146.1-microsoft-standard-WSL2 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Output of `bazel --version`:
bazel 7.0.2

Version of the Aspect rules, or other relevant rules from your `MODULE.bazel` file:
- aspect_rules_esbuild @ 0.18.0
- aspect_rules_js @ 1.38.0

Language(s) and/or frameworks involved:
pnpm

### How to reproduce

_No response_

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the upgrade from aspect_rules_esbuild v0.16.0 to v0.18.0 with aspect_rules_js v1.38.0 and Bazel 7.0.2, then inspect object-inspect/index.js and package.json around the referenced require and non-browser marking. Done means the dependency no longer causes non-browser scripts to throw the reported esbuild file-read error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.