pnpm install node-sass sass-loader sass -D
vite.config.js文件里添加
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
pluginOptions: {
'style-resouces-loader': {
preProcessor: 'scss',
patterns: []
}
}
})
页面里添加lang="scss"
<style lang="scss" scoped>
.homePage {
header {
height: 80px;
}
}
</style>