File tree Expand file tree Collapse file tree 4 files changed +22
-10
lines changed
packages/uni-app-uts/src/plugins Expand file tree Collapse file tree 4 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import { uniAppManifestPlugin } from '../js/manifestJson'
2727import { uniAppPagesPlugin } from '../js/pagesJson'
2828import { replaceExtApiPagePaths } from '../js/extApiPages'
2929import { uniAppCssPlugin , uniAppCssPrePlugin } from '../dom2/css'
30+ import { SHARED_DATA_LIB_NAME } from '../utils'
3031
3132export function init ( ) {
3233 const isDom2 = process . env . UNI_APP_X_DOM2 === 'true'
@@ -64,7 +65,7 @@ export function init() {
6465 version : process . env . UNI_COMPILER_VERSION ,
6566 cacheRoot : path . resolve ( process . env . UNI_APP_X_CACHE_DIR , '.uts2js/cache' ) ,
6667 sourceMap : enableSourceMap ( ) ,
67- sharedDataLibName : isDom2 ? 'libentry.so' : undefined ,
68+ sharedDataLibName : isDom2 ? SHARED_DATA_LIB_NAME : undefined ,
6869 modules : {
6970 vueCompilerDom,
7071 uniCliShared,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { uniAppManifestPlugin } from '../js/manifestJson'
2626import { uniAppPagesPlugin } from '../js/pagesJson'
2727import { replaceExtApiPagePaths } from '../js/extApiPages'
2828import { uniAppCssPrePlugin } from '../dom2/css'
29+ import { SHARED_DATA_LIB_NAME } from '../utils'
2930
3031export function init ( ) {
3132 const isDom2 = process . env . UNI_APP_X_DOM2 === 'true'
@@ -63,7 +64,7 @@ export function init() {
6364 version : process . env . UNI_COMPILER_VERSION ,
6465 cacheRoot : path . resolve ( process . env . UNI_APP_X_CACHE_DIR , '.uts2js/cache' ) ,
6566 sourceMap : enableSourceMap ( ) ,
66- sharedDataLibName : isDom2 ? 'libentry.so' : undefined ,
67+ sharedDataLibName : isDom2 ? SHARED_DATA_LIB_NAME : undefined ,
6768 modules : {
6869 vueCompilerDom,
6970 uniCliShared,
Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ import {
1919 uvueOutDir ,
2020 withSourcemap ,
2121} from '@dcloudio/uni-cli-shared'
22- import { configResolved , createUniOptions } from '../utils'
22+ import {
23+ SHARED_DATA_LIB_NAME ,
24+ configResolved ,
25+ createUniOptions ,
26+ } from '../utils'
2327import { uniAppCssPlugin } from './css'
2428import { uniAppJsPlugin } from './js'
2529import { rewriteImportVuePlugin } from './rewriteImportVue'
@@ -87,6 +91,13 @@ export function createUniAppJsEnginePlugin(
8791 : { }
8892
8993 const isDom2 = process . env . UNI_APP_X_DOM2 === 'true'
94+ const globals = {
95+ vue : 'Vue' ,
96+ '@vue/shared' : 'uni.VueShared' ,
97+ }
98+ if ( isDom2 && process . env . UNI_UTS_PLATFORM === 'app-ios' ) {
99+ globals [ SHARED_DATA_LIB_NAME ] = '__uniSharedDataLib'
100+ }
90101 return {
91102 name : 'uni:app-uts' ,
92103 apply : 'build' ,
@@ -121,10 +132,7 @@ export function createUniAppJsEnginePlugin(
121132 banner : `` ,
122133 format : isESM ? 'esm' : 'iife' ,
123134 entryFileNames : APP_SERVICE_FILENAME ,
124- globals : {
125- vue : 'Vue' ,
126- '@vue/shared' : 'uni.VueShared' ,
127- } ,
135+ globals,
128136 paths,
129137 plugins : isESM ? [ rewriteImportVuePlugin ( ) ] : [ ] ,
130138 manualChunks ( id ) {
Original file line number Diff line number Diff line change @@ -28,9 +28,7 @@ import { compileI18nJsonStr } from '@dcloudio/uni-i18n'
2828import type { ResolvedConfig } from 'vite'
2929import { ElementTypes , NodeTypes } from '@vue/compiler-core'
3030
31- const isXHarmony =
32- process . env . UNI_APP_X === 'true' &&
33- process . env . UNI_UTS_PLATFORM === 'app-harmony'
31+ export const SHARED_DATA_LIB_NAME = 'libentry.so'
3432
3533export function createUniOptions (
3634 platform : 'app-android' | 'app-ios' | 'app-harmony'
@@ -173,6 +171,10 @@ export function normalizeManifestJson(
173171 platform : 'app-android' | 'app-ios' | 'app-harmony' ,
174172 userManifestJson : Record < string , any >
175173) {
174+ const isXHarmony =
175+ process . env . UNI_APP_X === 'true' &&
176+ process . env . UNI_UTS_PLATFORM === 'app-harmony'
177+
176178 const app = userManifestJson [ platform ] || userManifestJson . app || { }
177179 const x = userManifestJson [ 'uni-app-x' ] || { }
178180 x . compilerVersion = process . env . UNI_COMPILER_VERSION || ''
You can’t perform that action at this time.
0 commit comments