vite.config.js
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import pxtovw from "postcss-px-to-viewport";
import styleImport, { VantResolve } from "vite-plugin-style-import";
const loder_pxtovw = pxtovw({
unitToConvert: "px", // 需要转换的单位,默认为"px"
viewportWidth: 750, // 设计稿的视口宽度
unitPrecision: 2, // 单位转换后保留的精度
propList: ["*"], // 能转化为vw的属性列表
viewportUnit: "vw", // 希望使用的视口单位
fontViewportUnit: "vw", // 字体使用的视口单位
selectorBlackList: ["ignore"], // 需要忽略的CSS选择器
exclude: [/node_module/],
});
import path from "path";
import copy from "rollup-plugin-copy";
export default defineConfig({
base: "/appH5/",
publicDir: "public",
server: {
host: true,
},
devServer: {
port: 9091,
proxy: {
"/nvsthird/ptzcontrol": {
target: "http://52.130.155.147:8888",
changeOrigin: true,
},
},
},
plugins: [
vue(),
vueJsx(),
styleImport({
libs: [
{
libraryName: "vant",
esModule: true,
resolveStyle: (name) => `vant/es/${name}/style`,
},
],
}),
],
css: {
postcss: {
plugins: [loder_pxtovw],
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@s": path.resolve(__dirname, "./src/static"),
},
},
build: {
assetsDir: "static",
// rollupOptions:{
// plugins:[copy({
// targets: [
// { src: 'public/*', dest: 'dist/static' }
// ]
// })]
// }
},
});