react-icons ES module seems broken
The exported ES module has internal imports without .js extensions which causes it to fail.
To reproduce:
npm i
cd packages/react-icons
npm run build
node --import='./lib/index.js'
The import fails because chunk-0 is imported without .js extension, as are all other subsequent imports.
This is making it really difficult to write tests for components that indirectly import react-icons (or other fluent packages - the issues seem widespread). Neither Node tests nor Playwright component tests are able to resolve these imports.
export * from './icons/chunk-0'should beexport * from './icons/chunk-0.js'(missing file extensions)from '../contexts'should befrom '../contexts/index.js'(directory imports)
Can be reproduced by setting "type": "module" and trying to import Fluent UI packages.
There's a temporary workaround of cd:ing into Fluent packages under node_modules and symlinking ESM -> CJS: mv lib lib-esm-backup && ln -sf lib-commonjs lib # react-icons uses lib-cjs instead and then fixing the exports in each package.json from "import": "./lib/index.js" to "import": "./lib-commonjs/index.js".
see https://github.com/microsoft/fluentui/issues/34685