41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
|
import { defineConfig } from "vite";
|
|||
|
import react from "@vitejs/plugin-react";
|
|||
|
import eslintPlugin from "vite-plugin-eslint";
|
|||
|
import { resolve } from "path";
|
|||
|
import postCssPxToRem from "postcss-pxtorem";
|
|||
|
|
|||
|
// https://vitejs.dev/config/
|
|||
|
export default defineConfig(() => {
|
|||
|
return {
|
|||
|
resolve: {
|
|||
|
alias: {
|
|||
|
"@": resolve(__dirname, "./src"),
|
|||
|
"@assets": resolve(__dirname, "./src/assets"),
|
|||
|
"@night": resolve(__dirname, "./src/assets/nightIngale")
|
|||
|
}
|
|||
|
},
|
|||
|
plugins: [
|
|||
|
react(), // * EsLint 报错信息显示在浏览器界面上
|
|||
|
eslintPlugin()
|
|||
|
],
|
|||
|
css: {
|
|||
|
postcss: {
|
|||
|
plugins: [
|
|||
|
postCssPxToRem({
|
|||
|
rootValue: 16, // 1rem的大小
|
|||
|
propList: ["*"] // 需要转换的属性,这里选择全部都进行转换
|
|||
|
})
|
|||
|
]
|
|||
|
}
|
|||
|
},
|
|||
|
server: {
|
|||
|
host: "0.0.0.0",
|
|||
|
port: 5000
|
|||
|
// cors: true, //默认启用并允许任何源
|
|||
|
// https: false
|
|||
|
// open: true, //在服务器启动时自动在浏览器中打开应用程序
|
|||
|
// 反向代理配置,注意rewrite写法
|
|||
|
}
|
|||
|
};
|
|||
|
});
|