uni-app-wx-study/vite.config.js

36 lines
921 B
JavaScript
Raw Normal View History

2024-10-17 13:37:58 +08:00
import path from "path";
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
2024-10-17 13:37:58 +08:00
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from "weapp-tailwindcss/vite";
// 注意: 打包成 h5 和 app 都不需要开启插件配置
const isH5 = process.env.UNI_PLATFORM === "h5";
const isApp = process.env.UNI_PLATFORM === "app";
const weAppTailwindcssDisabled = isH5 || isApp;
const resolve = (p) => {
return path.resolve(__dirname, p);
};
// https://vitejs.dev/config/
export default defineConfig({
2024-10-16 17:03:14 +08:00
build:{
},
plugins: [
uni(),
2024-10-17 13:37:58 +08:00
uvwt({
rem2rpx: true,
disabled: weAppTailwindcssDisabled
})
],
2024-10-17 13:37:58 +08:00
css: {
postcss: {
plugins: [
require("tailwindcss")({
// 注意此处,手动传入 `tailwind.config.js` 的绝对路径
config: resolve("./tailwind.config.js"),
}),
require("autoprefixer"),
]
},
},
})