Skip to content

The package have incorrect main/module/exports specified in its package.json. #111

@M0D1xD

Description

@M0D1xD

Before you start, please make sure to:

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-zj5nwzs7?file=src%2Fmain.ts

Validation

  • ⚠️ I understand that invalid, incomplete or redundant reproduction will make it arduous (even impossible) for us to help you
  • ⚠️ I understand that using this for unrelated purposes can lead to it being closed without further notice

Describe the bug and steps to reproduce

Basically the build doesn't contain the module "mjs" after publishing the build to the npm registry .

Image

npm run build
us-frontend@1.0.0 build
vue-tsc --noEmit && vite build
[dotenv@17.2.3] injecting env (0) from .env -- tip: ⚙️ write to custom object with { processEnv: myObject }
Duplicated imports "useRoute", the one from "vue-router" has been ignored and "vue-router/auto" is used
Duplicated imports "useRouter", the one from "vue-router" has been ignored and "vue-router/auto" is used
vite v7.1.9 building for production...
Duplicated imports "useRoute", the one from "vue-router" has been ignored and "vue-router/auto" is used
Duplicated imports "useRouter", the one from "vue-router" has been ignored and "vue-router/auto" is used
✓ 581 modules transformed.
✗ Build failed in 7.70s
error during build:
[commonjs--resolver] Failed to resolve entry for package "json-editor-vue". The package may have incorrect main/module/exports specified in its package.json.
at packageEntryFailure (file:///home/user/main-admin/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:11921:32)
at resolvePackageEntry (file:///home/user/main-admin/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:11918:2)
at tryNodeResolve (file:///home/user/main-admin/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:11820:17)
at Object.handler (file:///home/user/main-admin/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:11656:16)
at Object.handler (file:///home/user/main-admin/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:34062:13)
at file:///home/user/main-admin/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:22426:40
at async PluginDriver.hookFirstAndGetPlugin (file:///home/user/main-admin/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:22308:28)
at async resolveId (file:///home/user/main-admin/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:20785:26)
at async ModuleLoader.resolveId (file:///home/user/main-admin/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:21221:15)
at async Object.resolveId (file:///home/user/main-admin/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:4338:21)

Image

The published package.json exports.

  "exports": {
    ".": {
      "import": {
        "types": "./dist/json-editor-vue.d.mts",
        "default": "./dist/json-editor-vue.mjs"
      },
      "require": {
        "types": "./dist/json-editor-vue.d.ts",
        "default": "./dist/json-editor-vue.umd.js"
      }
    },
    "./*": "./*"
  },
  "main": "./dist/json-editor-vue.umd.js",
  "module": "./dist/json-editor-vue.mjs",
  "unpkg": "./dist/json-editor-vue.umd.js",
  "jsdelivr": "./dist/json-editor-vue.umd.js",
  "types": "./dist/json-editor-vue.d.ts",

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
    CPU: (4) x64 QEMU Virtual CPU version 2.5+
    Memory: 3.82 GB / 7.76 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.20.0 - /home/user/.nvm/versions/node/v22.20.0/bin/node
    Yarn: 1.22.22 - /home/user/.nvm/versions/node/v22.20.0/bin/yarn
    npm: 10.9.3 - /home/user/.nvm/versions/node/v22.20.0/bin/npm
  npmPackages:
    @fontsource/roboto: ^5.2.8 => 5.2.8 
    @mdi/font: 7.4.47 => 7.4.47 
    @mdi/js: ^7.4.47 => 7.4.47 
    @tsconfig/node22: ^22.0.2 => 22.0.2 
    @types/lodash: ^4.17.20 => 4.17.20 
    @types/node: ^24.5.2 => 24.7.0 
    @vitejs/plugin-vue: ^6.0.1 => 6.0.1 
    @vue/tsconfig: ^0.8.1 => 0.8.1 
    @vueup/vue-quill: ^1.2.0 => 1.2.0 
    axios: ^1.12.2 => 1.12.2 
    dotenv: ^17.2.2 => 17.2.3 
    eslint: ^9.36.0 => 9.37.0 
    eslint-config-vuetify: ^4.2.0 => 4.2.0 
    json-editor-vue: ^0.18.1 => 0.18.1 
    jwt-decode: ^4.0.0 => 4.0.0 
    lodash: ^4.17.21 => 4.17.21 
    npm-run-all2: ^8.0.4 => 8.0.4 
    pinia: ^3.0.3 => 3.0.3 
    prettier: ^3.6.2 => 3.6.2 
    sass-embedded: ^1.93.0 => 1.93.2 
    typescript: ~5.9.2 => 5.9.3 
    unplugin-auto-import: ^20.1.0 => 20.2.0 
    unplugin-fonts: ^1.4.0 => 1.4.0 
    unplugin-vue-components: ^29.0.0 => 29.1.0 
    unplugin-vue-router: ^0.15.0 => 0.15.0 
    vite: ^7.1.6 => 7.1.9 
    vite-plugin-vue-devtools: ^8.0.2 => 8.0.2 
    vite-plugin-vue-layouts-next: ^1.0.0 => 1.0.0 
    vite-plugin-vuetify: ^2.1.2 => 2.1.2 
    vue: ^3.5.21 => 3.5.22 
    vue-router: ^4.5.1 => 4.5.1 
    vue-tsc: ^3.1.1 => 3.1.1 
    vuetify: ^3.10.2 => 3.10.4

Package Manager

npm

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