angular.js - angular2+webpack编译错误

查看:114
本文介绍了angular.js - angular2+webpack编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

请大家帮忙看看,憋了一上午了,在线等,先谢谢了!
错误信息:

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(8,28): error TS2307: Cannot find module 'rxjs/Observable'.

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(9,25): error TS2307: Cannot find module 'rxjs/Subject'.

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(10,28): error TS2307: Cannot find module 'rxjs/Observable'.

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(11,25): error TS2307: Cannot find module 'rxjs/Subject'.

tsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "experimentalDecorators": true
    },
    "buildOnSave": false,
    "compileOnSave": false,
    "exclude": [
        "node_modules"
    ]
}

index.ts

import "es6-shim";
import "rx";
import {Component} from '@angular/core';

解决方案

已经找到答案,库用错了,应该是rxjs而不是rx。

这篇关于angular.js - angular2+webpack编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆