Reproduction
mkdir /tmp/vite-plugin-optimize-css-modules-cjs-repro
cd /tmp/vite-plugin-optimize-css-modules-cjs-repro
npm init -y
npm install vite-plugin-optimize-css-modules@1.4.0
node -e "require('vite-plugin-optimize-css-modules')"
Actual behavior
The CommonJS entrypoint fails to resolve:
Error: Cannot find module '.../node_modules/vite-plugin-optimize-css-modules/dist/index.umd.cjs'
code: 'MODULE_NOT_FOUND'
The published package declares this missing file in both main and the CommonJS export:
{
"main": "./dist/index.umd.cjs",
"exports": {
".": {
"require": "./dist/index.umd.cjs"
}
}
}
But the 1.4.0 tarball contains:
package/dist/counter.d.ts
package/dist/index.cjs
package/dist/index.d.ts
package/dist/index.js
Expected behavior
CommonJS consumers should be able to require('vite-plugin-optimize-css-modules'). The small fix is likely to point main and exports['.'].require at the existing ./dist/index.cjs, or adjust the build/publish output to include dist/index.umd.cjs.
Environment
- Package:
vite-plugin-optimize-css-modules@1.4.0
- Node.js:
v24.3.0
- npm: isolated temp project with a fresh install
Reproduction
Actual behavior
The CommonJS entrypoint fails to resolve:
The published package declares this missing file in both
mainand the CommonJS export:{ "main": "./dist/index.umd.cjs", "exports": { ".": { "require": "./dist/index.umd.cjs" } } }But the
1.4.0tarball contains:Expected behavior
CommonJS consumers should be able to
require('vite-plugin-optimize-css-modules'). The small fix is likely to pointmainandexports['.'].requireat the existing./dist/index.cjs, or adjust the build/publish output to includedist/index.umd.cjs.Environment
vite-plugin-optimize-css-modules@1.4.0v24.3.0