2016-05-12 167 views
1

我將我的項目從Angular2「2.0.0-beta.17」遷移到Angular2「2.0.0-rc.1」未找到模塊:錯誤:無法解析模塊'angular2/bundles/angular2-polyfills'

但同時建設項目中,我得到以下錯誤:在cmd中

ERROR in multi polyfills

Module not found: Error: Cannot resolve module 'angular2/bundles/angular2-polyfills' in C:\Users\akhilesh.kumar\Desktop\ang17
@ multi polyfills

而且在瀏覽器控制檯,我得到followig錯誤

Uncaught Error: Cannot find module "angular2/bundles/angular2-polyfills" 
Uncaught reflect-metadata shim is required when using class decorators 
Uncaught TypeError: Cannot read property 'isDefaultChangeDetectionStrategy' of undefined 

我的WebPack配置如下

config.entry = isTest ? {} : { 
    'polyfills': ['es6-shim/es6-shim.js', 'angular2/bundles/angular2-polyfills'], 
    'vendor': './src/vendor.ts', 
    'app': './src/bootstrap.ts' // our angular app 
    }; 

config.module = { 
    preLoaders: isTest ? [] : [{test: /\.ts$/, loader: 'tslint'}], 
    loaders: [......], 
    postLoaders: [], 
    noParse: [/.+zone\.js\/dist\/.+/, /.+angular2\/bundles\/.+/, /angular2-polyfills\.js/] 
    }; 

回答

2

Angular2 rc1中沒有更多的角度多邊形包。您需要手動包含ZoneJS和Reflect-metadata。

例如:

<script src="node_modules/zone.js/dist/zone.js"></script> 
<script src="node_modules/reflect-metadata/Reflect.js"></script> 
+0

我在的WebPack非常不好。那麼這些代碼呢。添加上述腳本後,我應該如何處理這些內容? –

+0

它的工作,但給我錯誤「未捕獲的錯誤:找不到模塊」angular2/bundles/angular2-polyfills「 –

相關問題