-
Notifications
You must be signed in to change notification settings - Fork 12k
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
3rd party lib wiki instructions - broken with ng serve -prod #951
Comments
Same here. ng build-prod passes well: `| Building"{{content-for}}" has been deprecated and will be removed before RC.
ng serve prod passes well as well: `Livereload server on http://localhost:49152 Build successful - 37548ms. Slowest Trees | Total Slowest Trees (cumulative) | Total (avg) and nothing happens in browser, except the Loading... string. No error. |
I can confirm this as well. I am using lodash in a simple service, and the dev builds work perfectly. When I run |
@justinrassier can you share what exactly was causing your problem? |
@vaskgjuri I created a simple repo demonstrating the problem and how to reproduce here: https://github.com/justinrassier/angular-cli-issue-951 Let me know if anything is unclear or if you need additional information. |
The repo published by @justinrassier the above shows exactly the same problem as I first reported. One thing I noticed in that repo, Justin added an additional tsconfig at the top of the project, in addition to the one inside the src provided by angular-cli. I can confirm that this is not the trigger of the problem. It fails just as spectacularly if you did not add an additional tsconfig. (By the way, I wonder if angular-cli is going to keep this arrangement of tsconfig down inside the src directory; I've been working with typescript quite extensively, and generally have found more typical approach putting tsconfig.json at the top seems to work best. But CLI is about going with the flow of however the tool wants to do things.) |
It seems that autodetecting the module format for Basically additional configuration is needed in
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. |
Thank you. Were you able to coax an error message out of it discover this config change needed? Or did you have to guess it, compare to other projects, etc.? |
I couldn't get an error message per se, but instead noticed that in prod mode only I posited that perhaps the bundling of |
Thank you, that is helpful, it is a good clue for me and others is the same thing in the future to know where to start looking around - specifically in the contents of libraries being loaded, to try determining what type of module they are and then instruct SystemJS as to that type. It is very unfortunate, although I'm guessing not something that angular-cli could fix, that the process starting the page (even before the angular bootstrap) fails in this way if system can't figure out how to load the library. Ouch. |
This worked like a charm for me as well. Thank you for the fix! Hopefully in the future this can be a bit more automated. I could see how this could trip some people up who may not understand the differences between the different types of module syntax enough to dig into their vendor libraries and help guide System.js to the right format type. But for now, I am excited to see it working. |
Yeah I can't quite get why SystemJS has no problem picking the module format up when loading it at runtime, but it breaks when bundled via builder. I'll try to open up an issue there, perhaps it is fixable. |
There is an issue opened on SystemJS builder regarding this topic: systemjs/builder#614 |
@filipesilva the workaround for 'moment' got me past the "empty page, no error" phase, but ng is still failing to copy the code needed for bootstrapping the whole process: i can't use the "tree shaking" approach to load systemjs - that's a chicken/egg scenario. |
@sgbeal do you have a separate issue for that? I don't want to hijack this issue, they are different and this one is also linked to a SystemJS issue so clutter here is doubly bad. |
@filipesilva i did have one, but you closed it yesterday ;) |
This issue should not be present anymore in the upcoming |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OSX El Cap
ng --version
. If there's nothing outputted, pleaserun in a Terminal:
node --version
And paste the result here.
do on your code? etc.
ng serve
, works fineng serve -prod
- the application never finishes bootstrapping, never replaces the "loading" text. No messages, just failure.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.
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:
The text was updated successfully, but these errors were encountered: