Skip to content

ERR_PACKAGE_PATH_NOT_EXPORTED when importing #34

@TheRealVaess

Description

@TheRealVaess

Hello !

I had a problem after installing vue-spring-bottom-sheet 2.4.2 and importing it in a component:
Resolve error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in .../my-project/node_modules/@douxcode/vue-spring-bottom-sheet/package.json

My bottom sheet code :

<bottom-sheet
    ref="customerBottomSheet"
    v-model="opened"
    :blocking="blocked"
    :can-swipe-close="false"
    :can-backdrop-close="false"
    :snap-points="snapPointsList"
    :initial-snap-point="1"
    @instinct-height="changeContentHeight"
    @snapped="snapped"
  >
...
</bottom-sheet>
...
import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
...
components: {
      BottomSheet
}

After searching for a while, i found a solution by modifying the package.json:

--- a/node_modules/@douxcode/vue-spring-bottom-sheet/package.json
+++ b/node_modules/@douxcode/vue-spring-bottom-sheet/package.json
   "exports": {
     ".": {
       "types": "./dist/index.d.ts",
-      "import": "./dist/index.mjs"
+      "import": "./dist/index.mjs",
+      "require": "./dist/index.mjs",
+      "default": "./dist/index.mjs"
     },
     "./dist/style.css": {
       "import": "./dist/style.css",

I'm using Node 22, npm 10, Vue 3.5, Vite 7

I don't know if it's a good solution, but it could be nice to take a look at and implement it in the package.

Thank you !

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreleased

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions