ng build -prod app stuck on loading screen
See original GitHub issue- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Mac El Capitan
- Versions.
angular-cli: 1.0.0-beta.5
node: 5.11.1
os: darwin x64
- Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
I have a component and in the file I do:
import { chartViewProvider } from '../shared/chartview.service';
@Component({
...,
providers: [
chartViewProvider
]
})
in chartview.service file
export let chartViewFactory = (service: IResearchService, obj: any): any => {
... return new object
}
};
export let chartViewProvider = provide(CHARTVIEW, {
useFactory: () => chartViewFactory
});
Where CHARTVIEW and ChartView are:
import { OpaqueToken } from '@angular/core';
import { IResearchService } from './research.service.interface';
export let CHARTVIEW = new OpaqueToken('ChartView');
export interface ChartView {
id: number | string;
name: string;
render(region: string, fromdate: string, todate: string, xCategories?: Array<string>): void;
}
Basically trying to use https://angular.io/docs/ts/latest/guide/dependency-injection.html guide for factory provider.
If I do ng serve
the app works perfectly.
If I do ng serve -prod
the app shows the loading screen and it never loads.
If I comment out
providers: [
// chartViewProvider
]
and then ng serve -prod
the app works fine.
- The log given by the failure. Normally this include a stack trace and some more information.
There is literally no error message either in the terminal or in the console.
Thanks for any help.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Using Angular CLI's 'new' and 'build' results in stuck on ...
ng serve seems to be working fine and localhost:4200 results in "app works!" displaying. Is this a known bug and if so, how...
Read more >Identify and Fix Build and Deployment Errors in Your Angular ...
In this guide, you will learn how to spot some of the most common build and deployment errors and how to resolve them...
Read more >[Angular cli] ng bulid --prod broken? Stuck on loading? - Reddit
ng serve works fine, but after building into the dist folder, I seem to be stuck on "Loading...". No files editted, just did...
Read more >[Solved]-Angular 6 App stuck on loading on localhost-angular.js
Hold an Angular 2+ app from loading until APP_INITIALIZER finishes running? Typekit fonts CSS not loading after ng build in Angular 5 app...
Read more >Fixed: Windows 10/8/7 Stuck on Loading/Boot/Startup Screen ...
Click "Advanced Options" and then click on "Go back to the previous build ". fix pc stuck on boot screen by rolling back....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same issue and could solve it by manually changing
<base href="/">
to<base href="./">
in myindex.html
. (Working on Windows)@filipesilva yes, I included ng2-bootstrap and along with it momentjs… I will try changing the package format as suggested in your answer in #951 first thing tomorrow morning and let you know if this helps.