question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng build -prod app stuck on loading screen

See original GitHub issue
  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Mac El Capitan
  2. Versions.
angular-cli: 1.0.0-beta.5
node: 5.11.1
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.

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.

  1. 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:closed
  • Created 7 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
SnuK87commented, Jul 25, 2017

I had the same issue and could solve it by manually changing <base href="/"> to <base href="./"> in my index.html. (Working on Windows)

1reaction
jwoehrlecommented, Jun 7, 2016

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found