Skip to content

CommonJS entrypoint points to missing dist/index.umd.cjs #11

Description

@jamilahmadzai

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions