1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/vsf-linux-MEUI

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
esbuild.mjs 1.3 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
yzhu Отправлено 18.05.2022 18:45 a4b5853
import { build } from "esbuild"
import { spawn } from 'child_process'
import kill from "tree-kill"
let childProcess = null
export function execute(command) {
return {
name: 'execute',
setup(build) {
build.onEnd(result => {
console.log(`build ended with ${result.errors.length} errors`)
if (childProcess) {
kill(childProcess.pid, 'SIGKILL')
}
console.log("[execute]", command)
childProcess = spawn(command, {
shell: true,
stdio: 'inherit',
env: process.env
})
console.log("spawn", command, childProcess.pid)
})
},
}
}
build({
entryPoints: [process.argv[2] ?? 'examples/hello/index.jsx'],
minify: process.env.NODE_ENV === 'production',
// bundle: false,
bundle: true,
external: ['NativeMEUI', 'os', 'std'],
target: "es2020",
outfile: 'dist/index.js',
format: "esm",
inject: ["framework/polyfill.js"],
watch: {
onRebuild(error, result) {
if (error) console.error('watch build failed:')
else console.log('watch build succeeded:')
},
},
plugins: [execute("./meui dist/index.js")]
})

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/vsf-linux-MEUI.git
git@api.gitlife.ru:oschina-mirror/vsf-linux-MEUI.git
oschina-mirror
vsf-linux-MEUI
vsf-linux-MEUI
master