style(vite.config.ts): format
This commit is contained in:
parent
75ad9af648
commit
f96a983985
@ -1,8 +1,7 @@
|
|||||||
import path from 'node:path'
|
|
||||||
import { execSync } from 'node:child_process'
|
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { defineConfig, loadEnv } from 'vite'
|
|
||||||
import Uni from '@dcloudio/vite-plugin-uni'
|
import Uni from '@dcloudio/vite-plugin-uni'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { defineConfig, loadEnv } from 'vite'
|
||||||
// @see https://uni-helper.js.org/vite-plugin-uni-pages
|
// @see https://uni-helper.js.org/vite-plugin-uni-pages
|
||||||
import UniPages from '@uni-helper/vite-plugin-uni-pages'
|
import UniPages from '@uni-helper/vite-plugin-uni-pages'
|
||||||
// @see https://uni-helper.js.org/vite-plugin-uni-layouts
|
// @see https://uni-helper.js.org/vite-plugin-uni-layouts
|
||||||
@ -13,9 +12,9 @@ import UniPlatform from '@uni-helper/vite-plugin-uni-platform'
|
|||||||
// @see https://github.com/uni-helper/vite-plugin-uni-manifest
|
// @see https://github.com/uni-helper/vite-plugin-uni-manifest
|
||||||
import UniManifest from '@uni-helper/vite-plugin-uni-manifest'
|
import UniManifest from '@uni-helper/vite-plugin-uni-manifest'
|
||||||
// @see https://unocss.dev/
|
// @see https://unocss.dev/
|
||||||
|
import { visualizer } from 'rollup-plugin-visualizer'
|
||||||
import UnoCSS from 'unocss/vite'
|
import UnoCSS from 'unocss/vite'
|
||||||
import AutoImport from 'unplugin-auto-import/vite'
|
import AutoImport from 'unplugin-auto-import/vite'
|
||||||
import { visualizer } from 'rollup-plugin-visualizer'
|
|
||||||
import ViteRestart from 'vite-plugin-restart'
|
import ViteRestart from 'vite-plugin-restart'
|
||||||
import { copyNativeRes } from './vite-plugins/copyNativeRes'
|
import { copyNativeRes } from './vite-plugins/copyNativeRes'
|
||||||
|
|
||||||
@ -98,13 +97,13 @@ export default ({ command, mode }) => {
|
|||||||
},
|
},
|
||||||
// 打包分析插件,h5 + 生产环境才弹出
|
// 打包分析插件,h5 + 生产环境才弹出
|
||||||
UNI_PLATFORM === 'h5' &&
|
UNI_PLATFORM === 'h5' &&
|
||||||
mode === 'production' &&
|
mode === 'production' &&
|
||||||
visualizer({
|
visualizer({
|
||||||
filename: './node_modules/.cache/visualizer/stats.html',
|
filename: './node_modules/.cache/visualizer/stats.html',
|
||||||
open: true,
|
open: true,
|
||||||
gzipSize: true,
|
gzipSize: true,
|
||||||
brotliSize: true,
|
brotliSize: true,
|
||||||
}),
|
}),
|
||||||
// 只有在 app 平台时才启用 copyNativeRes 插件
|
// 只有在 app 平台时才启用 copyNativeRes 插件
|
||||||
UNI_PLATFORM === 'app' && copyNativeRes(),
|
UNI_PLATFORM === 'app' && copyNativeRes(),
|
||||||
],
|
],
|
||||||
@ -136,12 +135,12 @@ export default ({ command, mode }) => {
|
|||||||
// 仅 H5 端生效,其他端不生效(其他端走build,不走devServer)
|
// 仅 H5 端生效,其他端不生效(其他端走build,不走devServer)
|
||||||
proxy: JSON.parse(VITE_APP_PROXY)
|
proxy: JSON.parse(VITE_APP_PROXY)
|
||||||
? {
|
? {
|
||||||
[VITE_APP_PROXY_PREFIX]: {
|
[VITE_APP_PROXY_PREFIX]: {
|
||||||
target: VITE_SERVER_BASEURL,
|
target: VITE_SERVER_BASEURL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(new RegExp(`^${VITE_APP_PROXY_PREFIX}`), ''),
|
rewrite: (path) => path.replace(new RegExp(`^${VITE_APP_PROXY_PREFIX}`), ''),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user