VS Code 的编译器 其实就是使用的 typescript 编译器,就是以前提到过的 tsserver.js

相应的编译参数可以参考 http://www.typescriptlang.org/docs/handbook/compiler-options.html

编译配置的话,只需要在项目中编写 jsconfig.json 或 tsconfig.json

1.增加配置属性

没仔细研究该怎么配置,直接按照paths的进行复制

{
name: "alias",
type: "object",
isTSConfigOnly: true,
category: ts.Diagnostics.Module_Resolution_Options,
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
},

2.在LoadModule方法中增加

    function _getModuleUsingBaseUrlAliasPath(alias, moduleName) {
var flag = false;
var path = moduleName;
do {
flag = false;
for (var key in alias) {
if (path == key || path.indexOf(key + '/') === 0) {
path = alias[key] + path.substr(key.length)
flag = true;
}
}
} while(flag);
return path;
}
function tryLoadModuleUsingBaseUrlAlias(extensions, moduleName, loader, failedLookupLocations, state) {
var baseUrl = state.compilerOptions.baseUrl;
var path = '';
var flag = false;
var path = _getModuleUsingBaseUrlAliasPath(state.compilerOptions.alias, moduleName);
if (path == moduleName) return false;
var candidate = ts.normalizePath(ts.combinePaths(baseUrl, path));
var res = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
return res;
}
function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) {
if (!state.compilerOptions.baseUrl) {
return undefined;
}
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName);
} if (state.compilerOptions.alias) {
var res = tryLoadModuleUsingBaseUrlAlias(extensions, moduleName, loader, failedLookupLocations, state);
if (res) {
return res;
}
}

最新文章

  1. Github的命令清除
  2. BZOJ4537 : [Hnoi2016]最小公倍数
  3. Web安全学习笔记之一
  4. iOS之UI--关于modal
  5. Java内存分配全面浅析
  6. iOS各种动画效果
  7. 30 分钟 Java Lambda 入门教程
  8. JS拖动div的原理
  9. iOS 下的相册与图片处理
  10. 福建省队集训被虐记——DAY3
  11. Https 客户端与服务器交互过程梳理(转)
  12. OpenCv error :unresolved external symbol(链接库没有加上)
  13. javascript小记四则:用JS写一个滚动横条文字,可以根据需要进行修改;
  14. React文档(八)条件渲染
  15. pandas简短介绍
  16. angularjs drag and drop
  17. RTMP HLS HTTP 直播协议一次看个够
  18. struct在C和C++中的使用总结
  19. UVA1378 A funny stone game
  20. mybatis的<choose>和<when>、<otherwise>标签

热门文章

  1. BigDATA面试题
  2. Codeforces Round #331 (Div. 2) A
  3. noip模拟赛 保留道路
  4. 自己做的jquery的autocomplete的一个例子
  5. Test Index
  6. PostHtml 中的一些有用的插件
  7. Item 6 消除过期的对象引用
  8. js刷新页面方法 -- (转)
  9. Perl6 Bailador框架(7):模版编写
  10. Linux 入门记录:九、Linux 文件系统挂载管理