Skip to content

[Bug Report][4.0.4] error TS2882: Cannot find module or type declarations for side-effect import of 'vuetify/styles'. #22766

Closed

Description

@Jisu-Woniu

Environment

Vuetify Version: 4.0.4
Vue Version: 3.5.31
OS: Linux

Steps to reproduce

  1. create new vuetify project
  2. update typescript dependency from 5.x.x to 6.x.x
  3. Run pnpm vue-tsc -b
src/main.ts:1:8 - error TS2882: Cannot find module or type declarations for side-effect import of 'vuetify/styles'.

1 import "vuetify/styles";
         ~~~~~~~~~~~~~~~~

Reproduction Link

https://github.com/Jisu-Woniu/digital-signature/tree/73b316175925b0dbf036d2efe6946cd33d92e4af

Activity

  1. J-Sek commented on Mar 26, 2026

    @J-Sek
    Contributor
    +// @ts-ignore
    import 'vuetify/styles'
  2. Jisu-Woniu commented on Mar 26, 2026

    @Jisu-Woniu
    Author

    This looks like a temporary fix. What is the root cause here?

  3. KaelWD commented on Mar 26, 2026

    @KaelWD
    Member

    Typescript 6 changed the default value for noUncheckedSideEffectImports to true. You can disable this again for now instead of adding the ignore comment.

  4. reopened this on Mar 26, 2026
  5. added
    T: enhancementFunctionality that enhances existing features
    and removed on Mar 26, 2026
  6. J-Sek commented on Mar 26, 2026

    @J-Sek
    Contributor

    What's the point of TS accessing styles anyway? IMO, should just do the job (autocomplete while typing in scripts and template) and avoid offsetting gains by wasting developers time with false-negatives. I agree slapping @ts-ignore is not pretty, but it just reflects the tooling fault.

  7. KaelWD commented on Mar 26, 2026

    @KaelWD
    Member

    microsoft/TypeScript#50394

    tsc doesn't know vuetify/styles is a stylesheet, it'd be nice if they just checked for file/exports existence for side effect imports instead of needing a type declaration though.

  8. Jisu-Woniu commented on Mar 26, 2026

    @Jisu-Woniu
    Author

    This explains one of my questions: I can import "vuetify/lib/styles/main.css" but not import "vuetify/styles". Clearly it's a TypeScript breaking change. So maybe I could try "noUncheckedSideEffectImports": false for now? Or is it OK to move the import to my CSS entrypoint?

  9. Jisu-Woniu commented on Mar 26, 2026

    @Jisu-Woniu
    Author

    Having moved import "vuetify/styles" to styles.css as:

    @import url("vuetify/styles");

    Now everything works fine.

  10. added a commit that references this issue on Mar 26, 2026
    c27c7f1
  11. self-assigned this
    on Mar 27, 2026
  12. added this to the v4.0.x milestone on Mar 27, 2026
  13. added a commit that references this issue on Mar 28, 2026
    f484098
  14. J-Sek commented on Mar 28, 2026

    @J-Sek
    Contributor

    resolved by cli#11 for new projects

    Existing projects can adapt (after upgrading to TS 6.0)

    • by adding // @ts-ignore
    • by adding declare module 'vuetify/styles'; in any *.d.ts file laying around
    • or by moving import to CSS or Sass file (e.g. main.scss)

    This generally does not affect Nuxt projects

  15. reopened this on Mar 30, 2026
  16. lukashroch commented on Apr 9, 2026

    @lukashroch

    @KaelWD could 2098fb1 be picked to v3? Or should v3 users with TS6 go for alt solutions J-Sek mentioned above?

  17. added a commit that references this issue on Apr 10, 2026
    1300d9e
  18. bloodykheeng commented on May 14, 2026

    @bloodykheeng

    solution is to use workspace version typescript in vscode read here

    1 Open the command palette (Ctrl/⌘ + Shift + P)
    2 Search for "TypeScript: Select TypeScript Version"
    3 Select "Use Workspace Version"

    solution to this Next.js: "Cannot find module or type declarations for side-effect import of './globals.css'" ts(2882)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions