mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-05 06:12:44 +08:00
commit
f84589b97d
@ -1,3 +1,5 @@
|
||||
import type { ProxyOptions } from 'vite';
|
||||
|
||||
/**
|
||||
* Configure according to the proxy list
|
||||
* @param proxyList
|
||||
|
@ -4,6 +4,7 @@ import { UnifiedViteWeappTailwindcssPlugin as uvtw } from 'weapp-tailwindcss/vit
|
||||
import autoImport from 'unplugin-auto-import/vite';
|
||||
import viteRestart from 'vite-plugin-restart';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
import { WeappTailwindcssDisabled, isH5 } from './platform';
|
||||
|
||||
interface VitePluginConfig {
|
||||
@ -14,6 +15,7 @@ export function createVitePlugins({ isProd }: VitePluginConfig): PluginOption[]
|
||||
return [
|
||||
// @ts-expect-error TODO uni() 会报错:uni is not a function,暂时使用此方式解决
|
||||
uni?.default(),
|
||||
nodeResolve(),
|
||||
uvtw({
|
||||
rem2rpx: true,
|
||||
disabled: WeappTailwindcssDisabled,
|
||||
|
@ -74,6 +74,7 @@
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-4020720240905001",
|
||||
"@egoist/tailwindcss-icons": "^1.8.1",
|
||||
"@iconify/json": "^2.2.245",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.16.5",
|
||||
|
@ -48,7 +48,7 @@ export default defineConfig(async ({ mode }) => {
|
||||
host: true,
|
||||
// open: true,
|
||||
port: Number.parseInt(VITE_PORT!, 10),
|
||||
proxy: resolveProxy([[VITE_PROXY_PREFIX, VITE_BASE_URL], [VITE_UPLOAD_PROXY_PREFIX, VITE_UPLOAD_URL]]),
|
||||
proxy: resolveProxy([[VITE_PROXY_PREFIX!, VITE_BASE_URL!], [VITE_UPLOAD_PROXY_PREFIX!, VITE_UPLOAD_URL!]]),
|
||||
},
|
||||
// 构建配置
|
||||
build: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user