Skip to content

Commit

Permalink
feat: 编译鸿蒙extapi支持UNI_APP_X条件编译
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangyaqi committed Dec 31, 2024
1 parent 178a17c commit baef7db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async function postBuildArkTS (isUniAppX = false) {
fs.outputJSON(extApiExportJsonPath, extApiExportWithHar, { spaces: 2 })
}

async function buildArkTS (target, buildJson) {
async function buildArkTS (target, buildJson, isX) {
const projectDir = path.resolve(__dirname, '../packages', target)
const { bundleArkTS } = require('../packages/uts/dist')
const start = Date.now()
Expand All @@ -344,6 +344,7 @@ async function buildArkTS (target, buildJson) {
})
// console.log(vars, envs)
for (const input of inputs) {
const outFilename = options.input[input]
const buildOptions = {
input: {
root: projectDir,
Expand All @@ -366,7 +367,7 @@ async function buildArkTS (target, buildJson) {
},
output: {
outDir: path.resolve(projectDir),
outFilename: options.input[input],
outFilename,
package: '',
imports: [],
sourceMap: false,
Expand All @@ -379,6 +380,7 @@ async function buildArkTS (target, buildJson) {
treeshake: {
noSideEffects: true,
},
isX: outFilename.includes('dist-x'), // TODO 优化此逻辑
wrapperFunctionName: options.wrapper?.name,
wrapperFunctionArgs: options.wrapper?.args,
},
Expand Down Expand Up @@ -424,8 +426,7 @@ async function buildArkTS (target, buildJson) {
if (target !== 'uni-app-harmony') {
return
}
await postBuildArkTS(false)
await postBuildArkTS(true)
await postBuildArkTS(isX)
}

async function sleep (ms) {
Expand Down

0 comments on commit baef7db

Please sign in to comment.