Reflect-metadata import


#1

Is there a way to not have to include…

import 'reflect-metadata';
import 'zone.js/dist/zone';

on every Angular 2 component? Could that be put into the Meteor bundler somewhere?

Currently (with Meteor 1.3.2 and Angular 2 using angular-meteor tutorial) apparently you must include the above imports all over the place, which means I have to refactor code that was working before including Meteor.


#2

Angular 2 heavily relies on some polyfills and dependencies. For example, in order to make it work, you’ll need to load (import) reflect-metatada and zone.js before you can use any component from angular2 itself.

There is a way to overcome that inconvenience (i.e., importing dependencies manually): you can install barbatus:angular2-runtime, a package that adds all the required dependencies. Since it’s a package, it’s loaded by Meteor before any user code.

If you prefer to install polyfills manually for some reason, you can try angular2-meteor-polyfills NPM. Import polyfills (whether on the client or server) by import ‘angular2-meteor-polyfills’.

From: https://github.com/Urigo/angular2-meteor#install-package