Languages
[Edit]
PT

Angular 7 - desativar o recarregamento automático do navegador

1 points
Created by:
Alyona
1114

Problema:

Como desativar o recarregamento autom√°tico no angular 7?

Quero parar de recarregar automaticamente no aplicativo angular 7.

Quando fa√ßo pequenas altera√ß√Ķes no projeto, toda a p√°gina da Web √© recarregada.
H√° uma forma de desabilit√°-lo?

Solução:

1. Encontre package.json
2. Altere a linha:
ANTES:

"start": "ng serve",

DEPOIS:

"start": "ng serve --live-reload false",

3. Reinicie o servidor

4. E ele funciona


O arquivo package.json fica assim:
ANTES:

{
  "name": "ng-gmaps",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve", <--------- THIS LINE BEFORE
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
  ....
  ....
  }
  ....
  ....
}

DEPOIS:

{  
  "name": "ng-gmaps",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --live-reload false", <--------- THIS LINE AFTER
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
  ....
  ....
  }
  ....
  ....
}

Contexto:
https://github.com/angular/angular-cli/issues/1755
https://github.com/angular/angular-cli/issues/9742

Hey ūüĎč
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.