Skip to content

Compatibility with Angular2 CLI #50

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

Closed
getglad opened this issue Mar 19, 2016 · 5 comments
Closed

Compatibility with Angular2 CLI #50

getglad opened this issue Mar 19, 2016 · 5 comments

Comments

@getglad
Copy link

getglad commented Mar 19, 2016

Can angular2-jwt be added to the DefinitelyTyped repo, like angular-jwt had been?

Adding it to the DefinitelyTyped repo is currently the path for compatibility with the Angular2 CLI

See: angular/angular-cli#274

@escardin
Copy link
Contributor

It is a native typescript library and as such does not need to be added to definitely typed.

@getglad
Copy link
Author

getglad commented Mar 21, 2016

got it - so typings install npm:angular2-jwt should do the trick?

@escardin
Copy link
Contributor

I don't think you should need to do anything. typescript will pick up the typings from the node_modules/angular2-jwt folder. You should only need typings for projects that don't distribute their typings in their npm module.

Could be wrong though.

@colltoaction
Copy link

I added the following line in angular-cli-build.js:

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      // existing code
      // .....
      'angular2-jwt/**/*.+(js|js.map)' // <---------------------------
    ]
  });
};

Would this solve your issue? The .d.ts files are also in the npm package in case you need them for other purposes.

@sch0lar
Copy link

sch0lar commented Jun 5, 2016

You'll need to add the following to get angular2-jwt to work with angular-cli:

In angular-cli-build.js:

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      // existing code
      // .....
      'angular2-jwt/**/*.+(js|js.map)'  // <---------------------------
    ]
  });
};

In system-config.ts:

/** Map relative paths to URLs. */
const map: any = {
  'angular2-jwt': 'vendor/angular2-jwt'  // <---------------------------
};

/** User packages configuration. */
const packages: any = {
  'angular2-jwt': {                      // <---------------------------
    main: 'angular2-jwt.js'              // <---------------------------
  },
};

Above seems to be working for me.
Source: https://github.com/angular/angular-cli/wiki/3rd-party-libs

@chenkie chenkie closed this as completed Sep 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants