publint icon indicating copy to clipboard operation
publint copied to clipboard

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

Open sapphi-red opened this issue 1 year ago • 1 comments

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

  • Node.js, Vite, esbuild: only validates the path
  • Webpack, TypeScript: check the file existence

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 avatar Mar 14 '24 13:03 sapphi-red

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

sapphi-red avatar Aug 22 '24 02:08 sapphi-red