mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-18 16:04:32 -04:00
@@ -50,6 +50,16 @@ function readDeaclareFiles(): string[] {
|
||||
const compilerOptions: ts.CompilerOptions = ts.readConfigFile(
|
||||
path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions;
|
||||
function setCompilerOptions() {
|
||||
const allPath: Array<string> = [
|
||||
'*',
|
||||
]
|
||||
if (!projectConfig.aceModuleJsonPath) {
|
||||
allPath.push('../../../../../*');
|
||||
allPath.push('../../*');
|
||||
} else {
|
||||
allPath.push('../../../../*');
|
||||
allPath.push('../*');
|
||||
}
|
||||
Object.assign(compilerOptions, {
|
||||
'allowJs': false,
|
||||
'importsNotUsedAsValues': ts.ImportsNotUsedAsValues.Preserve,
|
||||
@@ -59,10 +69,7 @@ function setCompilerOptions() {
|
||||
'target': ts.ScriptTarget.ES2017,
|
||||
'baseUrl': path.resolve(projectConfig.projectPath),
|
||||
'paths': {
|
||||
'*': [
|
||||
'*',
|
||||
'../../../../../*'
|
||||
]
|
||||
'*': allPath
|
||||
},
|
||||
'lib': [
|
||||
'lib.es2020.d.ts'
|
||||
|
||||
@@ -305,10 +305,21 @@ function getFileResolvePath(fileResolvePath: string, pagesDir: string, filePath:
|
||||
if (fs.existsSync(defaultModule)) {
|
||||
return defaultModule;
|
||||
}
|
||||
const entryModule: string = path.join(projectPath, '../../../../../', moduleFilePath);
|
||||
let entryModule: string;
|
||||
let etsModule: string;
|
||||
if (!projectConfig.aceModuleJsonPath) {
|
||||
entryModule = path.join(projectPath, '../../../../../', moduleFilePath);
|
||||
etsModule = path.join(projectPath, '../../', moduleFilePath);
|
||||
} else {
|
||||
entryModule = path.join(projectPath, '../../../../', moduleFilePath);
|
||||
etsModule = path.join(projectPath, '../', moduleFilePath);
|
||||
}
|
||||
if (fs.existsSync(entryModule)) {
|
||||
return entryModule;
|
||||
}
|
||||
if (fs.existsSync(etsModule)) {
|
||||
return etsModule;
|
||||
}
|
||||
let curPageDir: string = pagesDir;
|
||||
while (!fs.existsSync(fileResolvePath)) {
|
||||
fileResolvePath = path.join(curPageDir, NODE_MODULES, filePath);
|
||||
|
||||
@@ -102,7 +102,6 @@ function initConfig(config) {
|
||||
extensions: ['.js', '.ets', '.ts', '.d.ts'],
|
||||
modules: [
|
||||
projectPath,
|
||||
path.join(projectPath, '../../../../../'),
|
||||
'./node_modules',
|
||||
path.join(__dirname, 'node_modules'),
|
||||
path.join(__dirname, '../../api')
|
||||
@@ -125,11 +124,15 @@ function initConfig(config) {
|
||||
};
|
||||
}
|
||||
if (!projectConfig.aceModuleJsonPath) {
|
||||
config.resolve.modules.push(path.join(projectPath, '../../../../../'));
|
||||
config.resolve.modules.push(path.resolve(projectPath, '../../../../node_modules'));
|
||||
config.resolve.modules.push(path.resolve(projectPath, '../../../../../node_modules'));
|
||||
config.resolve.modules.push(path.resolve(projectPath, '../../'));
|
||||
} else {
|
||||
config.resolve.modules.push(path.join(projectPath, '../../../../'));
|
||||
config.resolve.modules.push(path.resolve(projectPath, '../../../node_modules'));
|
||||
config.resolve.modules.push(path.resolve(projectPath, '../../../../node_modules'));
|
||||
config.resolve.modules.push(path.resolve(projectPath, '../'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user