2016-05-12 142 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“ –

相关问题