Skip to content

publint warning due to missing .d.cts in dual module output #1603

@wChenonly

Description

@wChenonly

Version

System:
    OS: macOS 15.7.3
    CPU: (8) arm64 Apple M1 Pro
    Memory: 108.00 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 146.0.7680.165
    Safari: 26.4

Details

File (esm)              Size       
dist/rslib-runtime.js   1.2 kB  
dist/index.js           397.3 kB

               Total:   398.4 kB

File (cjs)       Size       
dist/index.cjs   412.8 kB

warn    Publint found 1 warning:
warn    pkg.exports["."].types types is interpreted as ESM when resolving with the "require" condition. 
This causes the types to only work when dynamically importing the package, even though the package exports CJS. 
Consider splitting out two "types" conditions for "import" and "require", and use the .cts extension, e.g. pkg.exports["."].require.types: "./dist/index.d.cts"

info    Publint found 1 suggestion:
info    pkg.repository.url is https://github.com/web-infra-dev/rsdoctor but could be a full git URL like "git+https://github.com/web-infra-dev/rsdoctor.git".

We currently provide both CJS and ESM outputs with "type": "module", but only generate a single .d.ts file (no .d.cts), which causes a warning from pluginPublint.

Are there any plans to move to ESM-only packages in the future?
If not, would it make sense to also generate .d.cts files to properly cover the CJS side and eliminate this warning?

Reproduce link

no

Reproduce Steps

pnpm build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions