cloudflare / cloudflare/workers-sdk
🐛 BUG: Wrangler executes from the wrong directory when package.json higher than wrangler.toml
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 183
Description
### Which Cloudflare product(s) does this pertain to?
Wrangler core
### What version(s) of the tool(s) are you using?
3.43.0
### What version of Node are you using?
20.12.0
### What operating system and version are you using?
macOS
### Describe the Bug
```
- package.json
- packageA
- package.json
- serviceA
- wrangler.toml
- src
- index.ts
```
Running `wrangler dev` in `packageA/serviceA` will result in Wrangler not picking up `packageA/serviceA/wrangler.toml` (so it'll error with ``✘ [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g. `wrangler dev path/to/script`) or the `main` config field.``
Instead, it thinks its running in `packageA`. This can be proven by running `wrangler dev -c serviceA/wrangler.toml` (and it correctly picking up the config).
Wrangler shouldn't hoist itself to the nearest package.json (esp. now that we support Python Workers). It should _maybe_ hoist itself to the nearest `wrangler.toml`. I don't really have strong opinions on that: I personally always run Wrangler in the same dir as `wrangler.toml`.
### Please provide a link to a minimal reproduction
_No response_
### Please provide any relevant error logs
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.