π bug ζθΏ° / Description
Follow-up to #9656: "type": "module" was removed in 3.1.13-0 (thanks!), but the package's main entry is still unusable under Node. lib/provider/index.js (CommonJS build) contains:
var _zh_CN = _interopRequireDefault(require("antd/es/locale/zh_CN"));
i.e. the CJS build reaches into antd's ESM build.
-
On Node < 22, requiring the ESM-syntax antd/es/locale/zh_CN.js as CommonJS fails with:
SyntaxError: Cannot use import statement outside a module
at .../antd/es/locale/zh_CN.js:1
at Object.<anonymous> (.../@ant-design/pro-components/lib/provider/index.js:19:37)
-
On Node β₯ 22 (require(esm) support), the file is re-loaded as ESM instead, and its extension-less relative import (../calendar/locale/zh_CN) then fails with:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../antd/es/calendar/locale/zh_CN'
imported from .../antd/es/locale/zh_CN.js
Either way, require('@ant-design/pro-components') crashes immediately, which breaks any tool that resolves the package through main (Vitest externalizing node_modules, Jest, plain Node SSR, β¦).
lib/provider/index.js is the only file under lib/ that references antd/es/* β the CJS build should require antd/lib/locale/zh_CN (or the root antd/locale/zh_CN) instead.
π· ε€η°ζ₯ιͺ€ / Steps to reproduce
npm install @ant-design/pro-components@3.1.14-1 antd@^6 react@^19 react-dom@^19
node -e "require('@ant-design/pro-components')"
π ζζη»ζ / Expected
The main (CommonJS) entry can be loaded by Node; the CJS build only references other CJS builds.
π» ε€η°δ»£η / Reproduction
Online (CodeSandbox Devbox β run npm install && npm test in the terminal; the devbox runs Node 20, so you get the SyntaxError variant):
https://codesandbox.io/p/devbox/92qjl3
π ε
Άδ»δΏ‘ζ― / Environment
- @ant-design/pro-components: 3.1.14-1 / antd: 6.5.0 / react: 19.x
- Node: reproduced on both v20.12.0 (SyntaxError) and v24 (ERR_MODULE_NOT_FOUND)
π bug ζθΏ° / Description
Follow-up to #9656:
"type": "module"was removed in 3.1.13-0 (thanks!), but the package'smainentry is still unusable under Node.lib/provider/index.js(CommonJS build) contains:i.e. the CJS build reaches into antd's ESM build.
On Node < 22, requiring the ESM-syntax
antd/es/locale/zh_CN.jsas CommonJS fails with:On Node β₯ 22 (
require(esm)support), the file is re-loaded as ESM instead, and its extension-less relative import (../calendar/locale/zh_CN) then fails with:Either way,
require('@ant-design/pro-components')crashes immediately, which breaks any tool that resolves the package throughmain(Vitest externalizing node_modules, Jest, plain Node SSR, β¦).lib/provider/index.jsis the only file underlib/that referencesantd/es/*β the CJS build should requireantd/lib/locale/zh_CN(or the rootantd/locale/zh_CN) instead.π· ε€η°ζ₯ιͺ€ / Steps to reproduce
npm install @ant-design/pro-components@3.1.14-1 antd@^6 react@^19 react-dom@^19node -e "require('@ant-design/pro-components')"π ζζη»ζ / Expected
The
main(CommonJS) entry can be loaded by Node; the CJS build only references other CJS builds.π» ε€η°δ»£η / Reproduction
Online (CodeSandbox Devbox β run
npm install && npm testin the terminal; the devbox runs Node 20, so you get theSyntaxErrorvariant):https://codesandbox.io/p/devbox/92qjl3
π ε Άδ»δΏ‘ζ― / Environment