Vite如何使用sass

问题描述 投票:0回答:5

enter image description here

Vue.config.js

enter image description here

当我安装 sass 和 sass-loader 时,如何配置以使用 sass 现在我使用 sass 提示错误 无法从 'D:\demo ite' 找到模块 'sass' enter image description here

vue.js sass vuejs2
5个回答
74
投票

你只需要使用以下命令安装 sass

npm install -D sass

此外,您可以在此处查看官方文档 https://vitejs.dev/guide/features.html#css-modules


9
投票

尝试

yarn add -D sass

这几乎就是最后一个屏幕中给出的错误。


由于人们显然更喜欢使用 NPM,但现在有很多包管理器,所以这里我们确实有一个通用的解决方案

通过使用ni,你可以拥有

ni -D sass

将其安装到您的项目中,无论它使用 NPM、yarn、PNPM 或 Bun。


2
投票

在其他答案中,他们使用

yarn
npm
但如果您使用
pnpm
:

pnpm i -D sass

i
install
:

的别名

https://pnpm.io/cli/install

-d
旗帜:

https://pnpm.io/cli/install#--dev--d


2
投票
 npm add -D sass

然后您可以在您的

.vue
文件中使用。
<style lang="scss"></style>

vite官网可以找到。vite scss


0
投票

只需使用顺风

https://tailwindcss.com/

只需使用顺风

© www.soinside.com 2019 - 2024. All rights reserved.