Skip to content

npm exports warnings #733

@thib3113

Description

@thib3113

Reading the changelog, I just saw you are missing the main attribute on your project .

Also, I just discovered a tool : https://www.npmjs.com/package/@arethetypeswrong/cli, that will check the exports of your packages, and here are the results :

$ attw --from-npm universal-cookie

universal-cookie v7.2.2

Build tools:
- typescript@^5.6.3
- rollup@^4.24.3

❗️ The resolved types use export default where the JavaScript file appears to use module.exports =. This will cause TypeScript under the node16 module mode to think an extra .default property access is required, but that will likely fail at runtime. These types should use export = instead of export default. https://github.com/arethetypeswrong/arethetypeswrong.githubb.io/blob/main/docs/problems/FalseExportDefault.md

🐛 Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (https://github.com/microsoft/TypeScript/issues/50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md

🎭 Import resolved to a CommonJS type declaration file, but an ESM JavaScript file. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md


┌───────────────────┬──────────────────────────────┐
│                   │ "universal-cookie"           │
├───────────────────┼──────────────────────────────┤
│ node10            │ ❗️ Incorrect default export │
├───────────────────┼──────────────────────────────┤
│ node16 (from CJS) │ ❗️ Incorrect default export │
├───────────────────┼──────────────────────────────┤
│ node16 (from ESM) │ 🐛 Used fallback condition   │
│                   │ 🎭 Masquerading as CJS       │
├───────────────────┼──────────────────────────────┤
│ bundler           │ 🐛 Used fallback condition   │
└───────────────────┴──────────────────────────────┘

also, I doesn't have a problem now with this package ... It's just to share that you will maybe got other errors with exports

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions