Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ship system.register bundle #64

Closed
mip1983 opened this issue Feb 16, 2016 · 4 comments
Closed

ship system.register bundle #64

mip1983 opened this issue Feb 16, 2016 · 4 comments

Comments

@mip1983
Copy link

mip1983 commented Feb 16, 2016

I pulled down angularfire2 from npm, added the script reference to my html and got cracking trying things out, and very quickly hit an issue that the typescript has been compiled in a way that needs require to work.

As an angular2 novice, I started with the guide from the docs (https://angular.io/docs/ts/latest/quickstart.html) and so have used the tsconfig.json they've outlined there. The angular2 js files themselves from npm are also using system.js.

Should this library not have the same typescript compilation settings to angular2?
Or perhaps I'm thinking about this wrong, maybe the npm package should include the ts files instead of the js, so the user compiles it according to their own tsconfig?

@mip1983
Copy link
Author

mip1983 commented Feb 16, 2016

I've so far got this working (i.e. no error when I run the app) by bringing the typescript source ts files locally, compiling with my tsconfig settings ("module": "system"), and putting them in a folder in my app, and referencing them as:

import {FIREBASE_PROVIDERS, defaultFirebase, AngularFire} from "./angularfire2/angularfire2";

@jeffbcross
Copy link
Contributor

This project doesn't yet ship bundles like Angular 2 does. I have a branch where I've started creating a System-register-format bundle.

In the mean time, Angular 2's non-bundled distribution is the same as this project, CJS+corresponding d.ts files. Since it sounds like you're using System loader to load your project, you just have to add this to your System.config:

System.config({
  paths: {
    angularfire2: 'node_modules/angularfire2/'
  },
  packages: {
    angularfire2: {
      main: 'angularfire2.js',
      defaultExtension: 'js'
    }
  }
}

@jeffbcross jeffbcross changed the title tsconfig.json using commonjs rather than system ship system.register bundle Feb 17, 2016
@jeffbcross
Copy link
Contributor

I updated the issue title and will leave it open as a reminder to ship the bundle.

@jeffbcross
Copy link
Contributor

Oops, I guess I already merged the logic that creates the bundles, just haven't incorporated it into the publish process yet: https://github.com/angular/angularfire2/blob/master/package.json#L12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants