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

typecheck not working with pnpm #126

Open
IlyaSemenov opened this issue Jun 19, 2024 · 4 comments
Open

typecheck not working with pnpm #126

IlyaSemenov opened this issue Jun 19, 2024 · 4 comments

Comments

@IlyaSemenov
Copy link

In a pnpm installation, nuxt typecheck fails with:

> nuxt typecheck

error TS2688: Cannot find type definition file for 'swiper/vue'.
  The file is in the program because:
    Entry point of type library 'swiper/vue' specified in compilerOptions


Found 1 error.

This is because nuxt-swiper pushes swiper/vue to types:

ctx.references.push({
types: 'swiper/vue'
})

but the Nuxt project itself doesn't have swiper as a dependency, so type checking fails.

Instead, nuxt-swiper should re-export swiper/vue (being swiper-nuxt dependency) as something like swiper-nuxt/types, and use it for the injected reference.

The current workaround is to manually install pnpm add swiper@^10.3.1 but this needs to be manually synced with swiper (the latest version of swiper which installs by default is already one major version ahead), and is thus error-prone.

@avxkim
Copy link

avxkim commented Aug 22, 2024

Just faced this issue, after switching to pnpm (used npm)

@pmioni
Copy link

pmioni commented Aug 30, 2024

Same issue here, problem started with a new pnpm version probably as we did not have it before.

@avxkim
Copy link

avxkim commented Aug 30, 2024

yeah, looks like it won't be fixed, so i chose npm over pnpm (slower, but more maintanable)

@rocketiscool
Copy link

rocketiscool commented Sep 10, 2024

Same issue with Nuxt3 and pnpm, any workarounds that can hide the type error?

Edit: Nevermind I just added swiper as a package also

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

4 participants