Akhilesh Kumar
Akhilesh Kumar

Reputation: 9355

Module not found: Error: Cannot resolve module 'angular2/bundles/angular2-polyfills'

I'm migrating my project from Angular2 "2.0.0-beta.17" to Angular2 "2.0.0-rc.1"

But while building my project I get following error:in 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

And in browser console I get followig error

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

My webpack config is as follows

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/]
  };

Upvotes: 1

Views: 2822

Answers (1)

Thierry Templier
Thierry Templier

Reputation: 202176

There is no more angular-polyfills bundle in Angular2 rc1. You need to manually include both ZoneJS and Reflect-metadata.

For example:

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

Upvotes: 2

Related Questions