123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { VantResolver } from '@vant/auto-import-resolver'
- import path from 'node:path'
- import postcssPxToViewport from 'postcss-px-to-viewport-8-plugin'
- export default defineConfig(({ mode }) => {
- const env = loadEnv(mode, process.cwd())
- return {
-
- envPrefix: 'APP_',
-
- plugins: [
-
- vue(),
-
- AutoImport({
-
- resolvers: [VantResolver()]
- }),
-
- Components({
-
- resolvers: [VantResolver()]
- })
- ],
- css: {
- postcss: {
- plugins: [
- postcssPxToViewport({
-
- unitToConvert: 'px',
-
- viewportWidth: 375,
-
- unitPrecision: 6,
-
- viewportUnit: 'vw',
-
- fontViewportUnit: 'vw',
-
- propList: ['*'],
-
- selectorBlackList: ['van-'],
-
- minPixelValue: 1,
-
- mediaQuery: false,
-
- replace: true,
-
- exclude: [/node_modules/],
-
- include: [],
-
- landscape: false
- })
- ]
- },
- preprocessorOptions: {
- scss: {
- silenceDeprecations: ['legacy-js-api'],
- additionalData: `@use "@/assets/style/variables.scss";`
- }
- }
- },
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src')
- }
- },
- server: {
- host: '0.0.0.0',
- proxy: {
- [env.APP_BASE_API]: {
- target: env.APP_BASE_SERVER_URL,
- changeOrigin: true
- }
- }
- }
- }
- })
|