Dan*_*esz 6 typescript visual-studio-2015 angular
升级到Angular 2后,Visual Studio 2015中的rc1打字稿调试停止了工作.我在meta标签中添加了以前的版本,但这导致现在关于'require'的所有其他类型的问题都是未定义的.有没有人能够让这个工作呢?
这是我的system.config.js文件
(function (global) {
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular'
};
// packages tells the System loader how to load when no filename
// and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
};
var meta = {
'*.js': { scriptLoad: true } //this allows TS debugging in VS
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/router-deprecated',
'@angular/testing',
'@angular/upgrade',
];
// add package entries for angular packages in
// the form '@angular/common': { main: 'index.js',
// defaultExtension: 'js' }
packageNames.forEach(function (pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
meta: meta,
map: map,
packages: packages
}
// filterSystemConfig - index.html's chance to modify config before
// we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }
System.config(config);
})(this);
Run Code Online (Sandbox Code Playgroud)
解决方法是在 cmd 中为项目文件夹运行以下命令
>tsc
Run Code Online (Sandbox Code Playgroud)
但首先要确保你已经安装了打字稿编译器
$ npm install typescript-compiler
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
301 次 |
| 最近记录: |