Closed regseb closed 1 year ago
You can setup it using options, I don't think it is a good idea to change default logic
Also I think you need to go to typescript
community and ask them about it and maybe ask them to change Node.js specific logic (not sure it is possible)
If you have types
after default
you need consider it as a bug https://github.com/microsoft/TypeScript/issues/46334#issuecomment-943669872
Feature request: Built-in typescript warning about it https://github.com/microsoft/TypeScript/issues/46861
In Community Conditions Definitions documentation, Node specifies that the "types"
property should always be included first.
So don't put "types"
after "default"
.
To import a library, I use jsdelivr which uses enhanced-resolve. I had a problem with the order of the properties in
exports
:default
wasn't at the end. https://github.com/jsdelivr/jsdelivr/issues/18496I prefer to define sources before types because sources are more important than types. And for the old properties
main
andtypes
, npm-package-json-lint definesmain
beforetypes
. It's more readable to have the same order formain
/types
andexports
sub-properties (e.g. cronnor/package.json).enhanced-resolve forces the
default
property to the end: assert default. Could be last only. The Node.js documentation indicates this:I understand that
default
should always be the last property amongnode-addons
,node
,import
,require
anddefault
. But the propertytypes
can be positioned wherever you want.I propose to filter the values of the
exports
to keep only the propertiesnode-addons
,node
,import
,require
anddefault
(maybe addwebpack
).Or exclude the
types
properties: