39 lines
917 B
JavaScript
39 lines
917 B
JavaScript
import { defineConfig } from "vite";
|
|
import uni from "@dcloudio/vite-plugin-uni";
|
|
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from "weapp-tailwindcss/vite";
|
|
const { resolve, WeappTailwindcssDisabled } = require("./shared")
|
|
|
|
const vitePlugins = [uni(), uvwt({
|
|
disabled: WeappTailwindcssDisabled
|
|
})];
|
|
|
|
const postcssPlugins = [
|
|
require("autoprefixer")(),
|
|
require("tailwindcss")({
|
|
config: resolve("./tailwind.config.js"),
|
|
}),
|
|
];
|
|
|
|
if (!WeappTailwindcssDisabled) {
|
|
postcssPlugins.push(
|
|
require("postcss-rem-to-responsive-pixel")({
|
|
rootValue: 32,
|
|
propList: ["*"],
|
|
transformUnit: "rpx",
|
|
})
|
|
);
|
|
}
|
|
/**
|
|
* @type {import('vite').UserConfig}
|
|
*/
|
|
export default defineConfig({
|
|
build: {
|
|
// sourcemap: true,
|
|
},
|
|
plugins: vitePlugins,
|
|
css: {
|
|
postcss: {
|
|
plugins: postcssPlugins,
|
|
},
|
|
},
|
|
}); |