2016-08-11 49 views
0

我正在嘗試使用Angular2和laravel 5.2,所以我試圖配置gulp來編譯打字稿文件。gulp elixir-typingcript未能編譯

這是我的package.json文件:

{ 
    "private": true, 
    "scripts": { 
    "prod": "gulp --production", 
    "dev": "gulp watch" 
    }, 
    "devDependencies": { 
    "gulp": "^3.9.1", 
    "laravel-elixir": "^5.0.0", 
    "bootstrap-sass": "^3.0.0", 
    "@angular/common": "2.0.0-rc.5", 
    "@angular/compiler": "2.0.0-rc.5", 
    "@angular/core": "2.0.0-rc.5", 
    "@angular/forms": "0.3.0", 
    "@angular/http": "2.0.0-rc.5", 
    "@angular/platform-browser": "2.0.0-rc.5", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.5", 
    "@angular/router": "3.0.0-rc.1", 
    "@angular/router-deprecated": "2.0.0-rc.2", 
    "@angular/upgrade": "2.0.0-rc.5", 
    "systemjs": "0.19.27", 
    "core-js": "^2.4.0", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "5.0.0-beta.6", 
    "zone.js": "^0.6.12" 
    }, 
    "dependencies": { 
    "elixir-typescript": "^2.0.0" 
    } 
} 

這是我tsconfig.json(我投入資源/資產/打字稿):

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

,並在年底我有我gulpfile.js:

var elixir = require('laravel-elixir'); 
var elixirTypscript = require('elixir-typescript'); 

elixir(function(mix) { 
    mix.sass('app.scss'); 

    mix.typescript('main.ts', 'public/js/'); 

    mix.copy('node_modules/@angular', 'public/js/angular'); 
    mix.copy('node_modules/when/es6-shim', 'public/js/es6-shim'); 
    mix.copy('node_modules/es6-promise', 'public/js/es6-promise'); 
    mix.copy('node_modules/rxjs', 'public/js/rxjs'); 
    mix.copy('node_modules/systemjs', 'public/js/systemjs'); 
    mix.copy('node_modules/zone.js', 'public/js/zone.js'); 

}); 

當我從控制檯啓動一飲而盡我得到了很多的錯誤,如:

/var/www/chat/laravel/node_modules/@angular/common/src/directives/ng_class.d.ts(81,34): error TS2304: Cannot find name 'Set'. 
[14:59:24] gulp-notify: [Laravel Elixir] TypeScript Compilation Failed!: /var/www/chat/laravel/node_modules/@angular/common/src/directives/ng_class.d.ts(81,34): error TS2304: Cannot find name 'Set'. 
{ [TypeScript error: /var/www/chat/laravel/node_modules/@angular/common/src/directives/ng_class.d.ts(81,34): error TS2304: Cannot find name 'Set'.] 
    name: 'TypeScript error', 
..... 

它似乎試圖編譯node_modules中的所有打字稿內容。我在tsconfig.json中使用了「排除」字段,但它看起來不起作用。

回答