mirror of
https://github.com/NetEase/tango.git
synced 2026-09-01 15:03:03 +08:00
fix: parse module with module alias (#147)
This commit is contained in:
@@ -1233,8 +1233,17 @@ export class Workspace extends EventTarget implements IWorkspace {
|
||||
let filename: string;
|
||||
this.routeModule?.routes.forEach((route) => {
|
||||
if (isPathnameMatchRoute(routePath, route.path) && route.importPath) {
|
||||
const absolutePath = route.importPath.replace('.', '/src');
|
||||
filename = this.getRealViewFilePath(absolutePath);
|
||||
if (route.importPath.startsWith('@/')) {
|
||||
filename = route.importPath;
|
||||
const alias = this.tangoConfigJson.getValue('sandbox.alias') || {};
|
||||
if (alias['@']) {
|
||||
filename = filename.replace('@', alias['@']);
|
||||
}
|
||||
filename = this.getRealViewFilePath(filename);
|
||||
} else {
|
||||
const absolutePath = route.importPath.replace('.', '/src');
|
||||
filename = this.getRealViewFilePath(absolutePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
return filename;
|
||||
|
||||
@@ -300,6 +300,19 @@ export interface ITangoConfigJson {
|
||||
* 外部资源,例如 js, css 文件等
|
||||
*/
|
||||
externalResources?: Record<string, any>;
|
||||
/**
|
||||
* 沙箱配置
|
||||
*/
|
||||
sandbox?: {
|
||||
/**
|
||||
* 在沙箱中执行的脚本
|
||||
*/
|
||||
evaluateJavaScript?: string;
|
||||
/**
|
||||
* 模块的别名
|
||||
*/
|
||||
alias?: Record<string, string>;
|
||||
};
|
||||
/**
|
||||
* 设计器配置
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user