Vue.config.js
when i install sass and sass-loader how can i to configure to use sass Now i use sass tips error Cannot find module 'sass' from 'D:\demo\vite'
Vue.config.js
when i install sass and sass-loader how can i to configure to use sass Now i use sass tips error Cannot find module 'sass' from 'D:\demo\vite'
You just need to install sass using the following command
npm install -D sass
Also, you may check the official docs here https://vitejs.dev/guide/features.html#css-modules
Try
yarn add -D sass
it's pretty much the error given in the last screen.
Since people prefer to use NPM apparently but that there is a lot of package managers nowadays, here we do have an universal solution
By using ni, you can have
ni -D sass
to install that in your project whatever it's using NPM, yarn, PNPM or bun.
btw if you aready did npm i sass
you can perfectly do npm i -D sass
the changes will be made automagically!
In other answers, they're using yarn
or npm
but If you're using pnpm
:
pnpm i -D sass
i
is an alias for install
:
-d
flag:
npm add -D sass
Then you can use in your .vue
file. <style lang="scss"></style>
You can find it in vite official website.Vite scss
© 2022 - 2024 — McMap. All rights reserved.