unjs / unbuild

📦 An unified javascript build system
MIT License
2.19k stars 84 forks source link

`main` property definition is missing in `package.json` #367

Closed deleonio closed 5 months ago

deleonio commented 5 months ago

Environment

node

Reproduction

use knip

Describe the bug

pnpm unused

> power-flow@0.0.0 unused /project
> knip

Analyzing workspace ....
Error loading /project/build.config.ts
Reason: No "exports" main defined in /project/node_modules/unbuild/package.json
 ELIFECYCLE  Command failed with exit code 2.

Additional context

No response

Logs

In the `package.json` is missing, the `main` property definition.
pi0 commented 5 months ago

Thanks for the issue. But at least for Node.js, this field is optional. So while it is something we can do to just fix knip, unless there is no reason to, I guess it is probably best that this tool fixes this to properly support exports as only field. (https://nodejs.org/api/packages.html#main-entry-point-export)