| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueDevTools from 'vite-plugin-vue-devtools'
- import pxtorem from 'postcss-pxtorem'
- // https://vite.dev/config/
- export default defineConfig(({ mode }) => {
- // eslint-disable-next-line no-undef
- const env = loadEnv(mode, process.cwd())
- console.log(env, 7777)
- return {
- base: env.VITE_PUBLIC_PATH || '/',
- plugins: [
- vue(),
- ],
- css: {
- postcss: {
- plugins: [
- pxtorem({
- // 以 2160 设计稿为基准,1rem = 216px(结合脚本按视口宽度动态缩放)
- rootValue: 216,
- propList: ['*'],
- replace: true,
- mediaQuery: false,
- exclude: /node_modules/i,
- }),
- ],
- },
- },
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- },
- },
- server: {
- host: '0.0.0.0',
- port: 5200,
- open: true,
- proxy: {
- '/hyb': {
- target: env.VITE_PROXY_TARGET,
- changeOrigin: true,
- },
- },
- },
- }
- })
|