bluwy / publint

Lint packaging errors
https://publint.dev
MIT License
960 stars 21 forks source link

Warn on the usage of fallback arrays in the `exports`/`imports` field #92

Open sapphi-red opened 6 months ago

sapphi-red commented 6 months ago

Fallback arrays in the exports/imports field works differently among tools.

To make a package compatible with all tools, I think it should be recommended to avoid using this feature. https://x.com/atcb/status/1736987593534034184, https://github.com/web-infra-dev/rspack/issues/5052#issuecomment-1867190334

Related issues: https://github.com/nodejs/node/issues/37928, https://github.com/nodejs/node/issues/44282, https://github.com/vitejs/vite/issues/4439, https://github.com/web-infra-dev/rspack/issues/5052, https://github.com/microsoft/TypeScript/issues/50762, https://github.com/webpack/enhanced-resolve/issues/400, https://github.com/lukeed/resolve.exports/issues/17, https://github.com/evanw/esbuild/issues/2974

sapphi-red commented 1 month ago

Webpack (enhanced-resolve) has changed their behavior to align with Node.js: https://github.com/webpack/enhanced-resolve/pull/429