Skip to content

package.json still points main, unpkg, jsdelivr, and exports.require to removed dist/index.umd.cjs #1846

Closed

Description

@trackoor

Overview of the problem

Oruga version: 0.14.6 (also on develop 4f440ba)
Vuejs version: 3.5.45
OS/Browser: Linux, Node.js v26.13.0

Description

PR #1597 (feat: drop cjs support and build esm only, released in 0.14.0) set build.lib.formats: ["es"] in packages/oruga/vite.config.ts and packages/examples/vite.config.ts, so dist/ now contains only index.js, index.js.map, and types/.

packages/oruga/package.json (and packages/examples/package.json) were not updated and still reference ./dist/index.umd.cjs:

"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
"unpkg": "./dist/index.umd.cjs",
"jsdelivr": "./dist/index.umd.cjs",
"typings": "./dist/types/index.d.ts",
"exports": {
  ".": {
    "types": "./dist/types/index.d.ts",
    "import": "./dist/index.js",
    "require": "./dist/index.umd.cjs"
  },

Because exports["."].require is present, Node.js (>= 20.19 / 22.12 / 24+, which natively supports require(esm)) resolves require("@oruga-ui/oruga-next") and require.resolve("@oruga-ui/oruga-next") to ./dist/index.umd.cjs instead of ./dist/index.js. Resolvers reading main and bare CDN URLs (https://unpkg.com/@oruga-ui/[email protected], https://cdn.jsdelivr.net/npm/@oruga-ui/[email protected]) also resolve to the missing file.

Expected behavior

All entry fields in package.json point to files that exist in dist/ (for example setting main, unpkg, and jsdelivr to ./dist/index.js and replacing require in exports["."] with "default": "./dist/index.js", or dropping the require condition).

Actual behavior

require('@oruga-ui/oruga-next') throws MODULE_NOT_FOUND for dist/index.umd.cjs:

Error: Cannot find module '.../node_modules/@oruga-ui/oruga-next/dist/index.umd.cjs'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1650:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1639:9)
    at resolveExports (node:internal/modules/cjs/loader:765:14)
... {
  code: 'MODULE_NOT_FOUND',
  path: '.../node_modules/@oruga-ui/oruga-next'
}

And https://cdn.jsdelivr.net/npm/@oruga-ui/[email protected] / https://unpkg.com/@oruga-ui/[email protected] return 404 for /dist/index.umd.cjs.

Steps to reproduce

  1. Install the latest package:
  2. Run in Node.js (v24 or v26):
    node --input-type=module -e "import('@oruga-ui/oruga-next').then(m => console.log(Object.keys(m).length))"
    # 135
    
    node -e "require('@oruga-ui/oruga-next')"
    # Error: Cannot find module '.../node_modules/@oruga-ui/oruga-next/dist/index.umd.cjs'

Credit: https://ucsbplse.github.io/

Activity

  1. Mittalnew commented on Nov 16, 2026

    @Mittalnew
    Contributor

    Hi! I'd like to work on this. Since #1597 made the build ESM-only, I'll update packages/oruga/package.json (and packages/examples/package.json) so that main, unpkg and jsdelivr point to dist/index.js, and remove the stale exports["."].require entry (or point it at the ESM build, if you'd like to keep require working on newer Node). I'll check the result with npm pack and publint/@arethetypeswrong/cli. Could you assign it to me?

  2. added theissue type on Nov 16, 2026
  3. mlmoravek commented on Nov 16, 2026

    @mlmoravek
    Member

    Hey @Mittalnew, just open a PR if you would like to implement the fix for this :)

  4. added a commit that references this issue on Nov 17, 2026
    5441684
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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions