Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Cannot find module 'vue'" after updating to 3.8.0 or up #347

Closed
3 tasks done
jashaj opened this issue Jul 10, 2024 · 1 comment
Closed
3 tasks done

Error: "Cannot find module 'vue'" after updating to 3.8.0 or up #347

jashaj opened this issue Jul 10, 2024 · 1 comment

Comments

@jashaj
Copy link

jashaj commented Jul 10, 2024

Describe the bug

I have a library project with vite, vite-plugin-dts, vue and pinia. The project has one Vue template, but that is for testing only and doesn't need to be exported. The library will be used in other Vue projects.
It worked fine with vite-plugin-dts until 3.7.3, but since 3.8.0 the build throws TypeScript errors:

src/lib/counter.ts:1:31 - error TS2792: Cannot find module 'vue'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?

1 import { ref, computed } from 'vue'
                                ~~~~~
src/lib/counter.ts:2:29 - error TS2792: Cannot find module 'pinia'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?

2 import { defineStore } from 'pinia'
                              ~~~~~~~

✓ 2 modules transformed.

Reproduction

https://github.com/jashaj/vue-dts-module-error

Steps to reproduce

  1. Clone the repo from https://github.com/jashaj/vue-dts-module-error
  2. Run npm ci
  3. Run npm run build

System Info

System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M2 Max
    Memory: 2.18 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    pnpm: 9.5.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 126.1.67.123
    Edge: 126.0.2592.87
    Safari: 17.5
  npmPackages:
    @vitejs/plugin-vue: ^5.0.5 => 5.0.5 
    vite: ^5.3.3 => 5.3.3 
    vite-plugin-dts: ^3.9.1 => 3.9.1

Validations

@qmhc
Copy link
Owner

qmhc commented Jul 23, 2024

You can refer to this FAQ.

@qmhc qmhc closed this as completed Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants