我的项目似乎没有最新的Angular代码,但我不确定原因。
这是我的package.json
"devDependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
这是node_modules/@angular/compiler/src/metadata_resolver.js
中的一项功能,我需要修补以修复this problem
function componentModuleUrl(reflector, type, cmpMetadata) {
if (cpl.isStaticSymbol(type)) {
return staticTypeModuleUrl(type);
}
if (isPresent(cmpMetadata.moduleId)) {
var moduleId = cmpMetadata.moduleId;
var scheme = getUrlScheme(moduleId);
return isPresent(scheme) && scheme.length > 0 ? moduleId :
"package:" + moduleId + MODULE_SUFFIX;
}
return reflector.importUri(type);
}
中的相同功能(在TypeScript中)
function componentModuleUrl(
reflector: ReflectorReader, type: Type<any>, cmpMetadata: Component): string {
if (cpl.isStaticSymbol(type)) {
return staticTypeModuleUrl(type);
}
const moduleId = cmpMetadata.moduleId;
if (typeof moduleId === 'string') {
const scheme = getUrlScheme(moduleId);
return scheme ? moduleId : `package:${moduleId}${MODULE_SUFFIX}`;
} else if (moduleId !== null && moduleId !== void 0) {
throw new Error(
`moduleId should be a string in "${stringify(type)}". See <shortened link that stackoverflow does not allow> for more information.\n` +
`If you're using Webpack you should inline the template and the styles, see <shortened link that stackoverflow does not allow>`);
}
return reflector.importUri(type);
}
答案 0 :(得分:1)