miniflare does not honor `wrangler` lookup for `package.json`
When I tested with miniflare, the package.json was read at the root directory of the package, not from the `entry-point.
The wrangler.toml had the following config:
[site]
bucket = "./public"
entry-point = "./dist"
The package.json:
{
"main": "./dist/worker.js"
}
When I performed a wrangler publish, I received an error that the ./dist directory did not have a package.json.
✨ Build completed successfully!
🌀 Created namespace for Workers Site "__fingerprint-workers_sites_assets"
✨ Success
🌀 Uploading site files
Error: Your JavaScript project is missing a `package.json` file; is `/Users/me/workspace/fingerprint/./dist` the wrong directory?
Expected:
miniflare would have the same lookup path for the package.json when the entry-point is configured.
Hey! 👋 Thanks for raising this. Looks like wrangler uses the entry-point as the package directory if [site] is defined: https://github.com/cloudflare/wrangler/blob/6408b15a4961d0bfa3934d76a540e2d1929f8c6d/src/settings/toml/target.rs#L44
Interestingly, this appears to default to workers-site if a bucket is defined without an entry-point:
https://github.com/cloudflare/wrangler/blob/881a22984c98730a87d69ef7f3a855b74f76822e/src/settings/toml/site.rs#L38
We should probably be following this behaviour though. 👍
Hey! 👋 I'm going to close this as it's unlikely we'll have time to fix this in Miniflare 2. Our development effort is primarily focused on version 3. I'd recommend you use npx wrangler dev for development instead. 👍