Сегодня возникла досадная проблема с моим angular dev-сервером. Кажется, что сервер перекомпилируется, пока я вношу изменения в свои файлы:
Date: 2020-07-14T19:26:02.488Z - Hash: b37a4d2f839b2f8093b5
4 unchanged chunks
chunk {main} main.js, main.js.map (main) 69.3 kB [initial] [rendered]
Time: 466ms
: Compiled successfully.
, но сам браузер, похоже, не отражает эти изменения. Я использую proxy.config, чтобы обойти проблему cors, и мне интересно, связано ли это с этим. Меня раздражает повторная компиляция каждый раз, когда я вношу изменения. Кто-нибудь еще сталкивался с этим раньше? Прикрепленный прокси, angular и пакет. json
РЕДАКТИРОВАТЬ: для чего это стоит, кажется, что закрытие вкладки и перезапуск работает. Все еще интересно выяснить, почему это так.
angular. json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"sideWays": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/sideWays",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
"src/styles.css"
],
"scripts": []
},
"proxyConfig": "src/proxy.conf.json",
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sideWays:build"
},
"configurations": {
"production": {
"browserTarget": "sideWays:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sideWays:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "sideWays:serve"
},
"configurations": {
"production": {
"devServerTarget": "sideWays:serve:production"
}
}
}
}
}
},
"defaultProject": "sideWays",
"cli": {
"analytics": "14f604da-02cd-43dd-aa3d-4397a621a365"
}
}
package.json
{
"name": "side-ways",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start":"ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~9.1.1",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.1",
"@angular/compiler": "~9.1.1",
"@angular/core": "~9.1.1",
"@angular/forms": "~9.1.1",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.1",
"@angular/platform-browser-dynamic": "~9.1.1",
"@angular/router": "~9.1.1",
"fs": "0.0.1-security",
"pdf-parse": "^1.1.1",
"puppeteer": "^5.0.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.1",
"@angular/cli": "~9.1.1",
"@angular/compiler-cli": "~9.1.1",
"@angular/language-service": "~9.1.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.12.47",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
}
}
proxy.config. json
{
"/api/*": {
"target": "http://localhost:1234",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
},
"/download/*": {
"target": "http://localhost:1234",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
}
}