Repository navigation
Description
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
- Install the latest package:
npm install @oruga-ui/[email protected] [email protected]
- 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
Mittalnew commentedon Nov 16, 2026
Hi! I'd like to work on this. Since #1597 made the build ESM-only, I'll update
packages/oruga/package.json(andpackages/examples/package.json) so thatmain,unpkgandjsdelivrpoint todist/index.js, and remove the staleexports["."].requireentry (or point it at the ESM build, if you'd like to keeprequireworking on newer Node). I'll check the result withnpm packandpublint/@arethetypeswrong/cli. Could you assign it to me?mlmoravek commentedon Nov 16, 2026
Hey @Mittalnew, just open a PR if you would like to implement the fix for this :)
fix: point package.json entry fields at the ESM-only build (oruga-ui#…