!155 1.0工具链支持引入不存在文件

Merge pull request !155 from fanjiaojiao/master
This commit is contained in:
openharmony_ci 2023-08-10 03:47:50 +00:00 committed by Gitee
commit 3e801a0759
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -286,7 +286,8 @@ export function parseRequireModule (source, resourcePath) {
for (let requireStatement of requireStatements) {
const requireStatementExec = /\((\"|\')(.+)(\"|\')\)/.exec(requireStatement);
if (requireStatement.match(REG_SYSTEM) && requireStatementExec && requireStatementExec.length > 3) {
if (systemModules.length == 0 || systemModules.includes(requireStatementExec[2] + '.d.ts')) {
if (systemModules.length == 0 || systemModules.includes(requireStatementExec[2] + '.d.ts') ||
process.env.DEVICE_LEVEL === 'lite') {
source = source.replace(requireStatement, requireStatement.replace('require', 'requireModule'));
}
}