angular-cli: 3rd party lib wiki instructions - broken with ng serve -prod

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

OSX El Cap

  1. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version And paste the result here.
$ ng --version
(node:11861) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.5
node: 6.1.0
os: darwin x64
  1. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
  1. The log given by the failure. Normally this include a stack trace and some more information.

This is an extremely frustrating failure mode: there is no log output. There is no error. If there is nothing in the terminal, there is nothing in the browser console. The application simply fails to ever come to life.

  1. Mention any other details that might be useful.

    Thanks! We’ll be in touch soon.

Based on the number of issues open in the last few days that mention it, the wiki page about adding libraries appears to be insufficient at best, and more likely wrong (at least for -prod). I suggest replacing it or augmenting it with a demo repository showing an example:

  • Several common third-party libraries, integrated in the recommended way.
  • Tested with each new CLI release.
  • Tested with the -prod option.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 17 (6 by maintainers)

Most upvoted comments

It seems that autodetecting the module format for moment was broken. I’ve updated https://github.com/angular/angular-cli/wiki/3rd-party-libs with current steps and tested locally, please tell me if they don’t work for you.

Basically additional configuration is needed in system-config.js:

const packages: any = {
  'moment':{
    format: 'cjs'
  }
};

Regarding the tsconfig, they were put down in the projects themselves because there are scenarios where one can have multiple apps in a single repo. https://github.com/angular/material2 for instance does this.