feat(mobile-app): prepare native app packaging
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
import { defineConfig } from 'vite';
|
||||
import uniPlugin from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
@@ -9,6 +10,13 @@ const devHost = process.env.HOST || '0.0.0.0';
|
||||
const proxyTarget = process.env.VITE_PROXY_TARGET || 'http://127.0.0.1:8080';
|
||||
// 代理到线上等已带 /dev-api 前缀的网关时,设 VITE_PROXY_KEEP_PREFIX=1 保留前缀
|
||||
const keepProxyPrefix = process.env.VITE_PROXY_KEEP_PREFIX === '1';
|
||||
// DCloud's current App compiler imports two internal lifecycle helpers from
|
||||
// `vue`. Public Vue packages intentionally do not export them, so provide a
|
||||
// narrow App-only compatibility module. H5 continues to resolve the normal
|
||||
// Vue package.
|
||||
const appVueRuntimeShim = process.env.UNI_PLATFORM === 'app'
|
||||
? fileURLToPath(new URL('./src/shims/vue-app-runtime.js', import.meta.url))
|
||||
: undefined;
|
||||
|
||||
const proxy = {
|
||||
'/dev-api': {
|
||||
@@ -21,6 +29,9 @@ const proxy = {
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
resolve: appVueRuntimeShim
|
||||
? { alias: { vue: appVueRuntimeShim } }
|
||||
: undefined,
|
||||
server: {
|
||||
host: devHost,
|
||||
port: devPort,
|
||||
|
||||
Reference in New Issue
Block a user