提交 8f162c13 编写于 作者: fxy060608's avatar fxy060608

wip(uts): compiler

上级 7a1b891d
......@@ -201,13 +201,23 @@ function resolveUtsFile(
}
export function resolveUTSCompiler(): typeof UTSCompiler {
let compilerPath: string = ''
if (isInHBuilderX()) {
return require(path.resolve(
process.env.UNI_HBUILDERX_PLUGINS,
'uniapp-uts'
))
try {
compilerPath = require.resolve(
path.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'uniapp-uts')
)
} catch (e) {}
}
if (!compilerPath) {
try {
compilerPath = require.resolve('@dcloudio/uni-uts-v1', {
paths: [process.env.UNI_CLI_CONTEXT],
})
} catch (e) {}
}
if (!compilerPath) {
throw 'uts compiler is not found'
}
return require(require.resolve('@dcloudio/uni-uts-v1', {
paths: [process.env.UNI_CLI_CONTEXT],
}))
return require(compilerPath)
}
......@@ -150,8 +150,7 @@ exports.default = () => [
const isSecureNetworkEnabled = (0, uni_cli_shared_1.isEnableSecureNetwork)(inputDir, platform);
return {
define: {
'process.env.UNI_SECURE_NETWORK_ENABLE': isSecureNetworkEnabled,
'process.env.UNI_SECURE_NETWORK_CONFIG': process.env.UNI_SECURE_NETWORK_CONFIG,
'process.env.UNI_SECURE_NETWORK': isSecureNetworkEnabled,
},
};
},
......
......@@ -152,7 +152,7 @@ function resolveSourceMapFile(outputDir: string, kotlinFile: string) {
async function compile(filename: string) {
if (!process.env.UNI_HBUILDERX_PLUGINS) {
return console.error('process.env.UNI_HBUILDERX_PLUGINS is not found')
throw 'process.env.UNI_HBUILDERX_PLUGINS is not found'
}
const { bundle, UtsTarget } = getUtsCompiler()
const inputDir = process.env.UNI_INPUT_DIR
......
......@@ -40,7 +40,7 @@ export async function runSwiftDev(_filename: string) {}
async function compile(filename: string) {
if (!process.env.UNI_HBUILDERX_PLUGINS) {
return console.error('process.env.UNI_HBUILDERX_PLUGINS is not found')
throw 'process.env.UNI_HBUILDERX_PLUGINS is not found'
}
const { bundle, UtsTarget } = getUtsCompiler()
const inputDir = process.env.UNI_INPUT_DIR
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册