css 未找到预处理器依赖项“sass”

rqdpfwrv  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(85)

I install saas using npm i saas and when i create file name using app.sccs then it show this error and i also install its dependency
我只是使用vite创建项目(React+ typescript )创建我的个人项目,我安装saas使更好看,使用npm我saas,当我创建文件名使用app.sccs然后它显示此错误,我也安装其依赖,需要帮助我们需要在vite要求或导入saas(React+ typescript )或我如何才能克服这个

s6fujrry

s6fujrry1#

安装依赖。请确保您安装了SassSass-Loader

第一个月
Vite配置:更新Vite设置,处理SASS文件,需要在vite.config.jsvite.config.ts文件中添加SASS插件。

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import "./path/to/your/variables";`, // Optional: Import your global variables
      },
    },
  },
});

字符串
"./path/to/your/variables"替换为SASS全局变量文件的路径。
如果您创建了一个名为app.scss的文件或其他.scss文件,请确保将其导入或包含在您的React组件中。import './app.scss';

相关问题