Solve [Could not find the module "./index.module.scss" or its corresponding type declaration. ts(2307)]

The project uses react 18 and vite 3,
insert image description here
first create it in the same level directory as src globals.d.ts, and add the following code

declare module '*.scss';

Finally, add in the include of tsconfig "./**/*.ts", and add in exclude"node_modules/**/*"

  "include": [
      "src",
      "./**/*.ts"
    ],
    "exclude": ["node_modules/**/*"]

The directory structure is as follows
insert image description here

Guess you like

Origin blog.csdn.net/weixin_47287832/article/details/128475638