The problem is whether it is a bug or a deliberate design. I think when declaration is set as false explicitly, it should be false. It is counter-intuitive that set it as false but it still work. So in my option, user-initiated actions should have the highest priority.
Environment
Node.js
: v20.10.0pnpm
: v8.15.5unbuild
: v2.0.0Reproduction
See minirepo.
Describe the bug
The option
declaration
do not do anything because in the end it will be set according toexports
inpackage.json
.declaration: false
will not work:When in
package.json
:The
declaration
will be settrue
if the values ofexports
contains any files named*.d.(m|c)?ts
inpackage.json
.Also, because of the same reason,
declaration: 'node16'
can not work too, it is same astrue
instead of the description in comments.More details refer to:
https://github.com/unjs/unbuild/blob/bfb4a348421826ad48072ca1cf70973e6caa5b1d/src/auto.ts#L34
https://github.com/unjs/unbuild/blob/bfb4a348421826ad48072ca1cf70973e6caa5b1d/src/auto.ts#L154
The problem is whether it is a bug or a deliberate design. I think when
declaration
is set asfalse
explicitly, it should befalse
. It is counter-intuitive that set it asfalse
but it still work. So in my option, user-initiated actions should have the highest priority.Additional context
To fix it, refer to:
https://github.com/unjs/unbuild/blob/bfb4a348421826ad48072ca1cf70973e6caa5b1d/src/auto.ts#L34
If
declaration
is notundefined
, it should use what user provided.I am glad to provide a PR for that!
Logs
No response