Skip to content

Failed to resolve import source when using PNPM #10121

@ocavue

Description

@ocavue

Vue version

3.4.14

Link to minimal reproduction

https://github.com/issueset/vue-sfc-pnpm-issue

Steps to reproduce

Open the following three links. They are the same minimal repo with different package managers.

npm and yarn work fine, but pnpm throws the following error.

✓ 3 modules transformed.
[vite:vue] [@vue/compiler-sfc] Failed to resolve import source "@prosekit/vue".

/home/projects/nbwijjbqo.github/node_modules/prosekit/dist/_tsup-dts-rollup.d.ts
1  |  import { addMark } from '@prosekit/core';
2  |  import { AddMarkStep } from '@prosekit/pm/transform';
   |                                        ^^^^^^^^^^^^^^^^
3  |  import { AddNodeMarkStep } from '@prosekit/pm/transform';
4  |  import { AllSelection } from '@prosekit/pm/state';
file: /home/projects/nbwijjbqo.github/src/comp.vue
error during build:
Error: [@vue/compiler-sfc] Failed to resolve import source "@prosekit/vue".

It seems that the build would be fine if I remove the defineProps<VueNodeViewProps> in src/comp.vue.

While this could be a bug on the pnpm, this error is thrown by @vue/compiler-sfc, so I am submitting the issue here so that maybe the Vue team could check it out and give some more information.

(I don't have a link for bun because I cannot get bun installed in stackblitz. However, when I test bun locally, it works fine too).

What is expected?

No error

What is actually happening?

[vite:vue] [@vue/compiler-sfc] Failed to resolve import source "@prosekit/vue".

System Info

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M2
    Memory: 107.95 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - /opt/homebrew/opt/node@18/bin/node
    Yarn: 1.22.19 - /opt/homebrew/opt/node@18/bin/yarn
    npm: 9.6.7 - /opt/homebrew/opt/node@18/bin/npm
    pnpm: 8.9.2 - /opt/homebrew/opt/node@18/bin/pnpm
    bun: 1.0.4 - ~/.bun/bin/bun
  Browsers:
    Chrome: 120.0.6099.216
    Chrome Canary: 122.0.6249.0
    Safari: 17.2.1
    Safari Technology Preview: 17.4
  npmPackages:
    vue: 3.4.14 => 3.4.14

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: sfc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions