feat: 添加postcss依赖
This commit is contained in:
@@ -8,6 +8,8 @@ import imagemin from 'unplugin-imagemin/vite'
|
||||
import viteCompression from 'vite-plugin-compression'
|
||||
import { createHtmlPlugin } from 'vite-plugin-html'
|
||||
import legacy from '@vitejs/plugin-legacy'
|
||||
import postcssPresetEnv from 'postcss-preset-env'
|
||||
import autoprefixer from 'autoprefixer'
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
//配置参数
|
||||
@@ -89,6 +91,26 @@ export default defineConfig(({ mode }) => {
|
||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'], // 默认值,这些文件引入时不需要写后缀
|
||||
},
|
||||
css: {
|
||||
modules: {
|
||||
// 一般我们可以通过 generateScopedName 属性来对生成的类名进行自定义
|
||||
// 其中,name 表示当前文件名,local 表示类名
|
||||
generateScopedName: "[name]__[local]___[hash:base64:5]"
|
||||
},
|
||||
postcss:{
|
||||
plugins:[
|
||||
postcssPresetEnv(),
|
||||
autoprefixer({ // 自动添加前缀
|
||||
overrideBrowserslist: [
|
||||
"Android 4.1",
|
||||
"iOS 7.1",
|
||||
"Chrome > 31",
|
||||
"ff > 31",
|
||||
"ie >= 8"
|
||||
],
|
||||
})
|
||||
|
||||
]
|
||||
},
|
||||
preprocessorOptions: {
|
||||
less: {
|
||||
javascriptEnabled: true,
|
||||
|
Reference in New Issue
Block a user