ng build works but ng build --prod throws an error - javascript

I am a student learning Angular by building project. When i do ng build it works but ng build --prod gives an error.
I have tried removing node_modules and then reinstalling it again.
The error says as follows:
ERROR in ./src/app/app.module.ngfactory.js 41:3371-3377 "export 'ɵa'
(imported as 'i12') was not found in '#angular/common'
Here is my package.json file.
"name": "angular-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "~8.2.0",
"#angular/cdk": "^8.1.3",
"#angular/common": "~8.2.0",
"#angular/compiler": "~8.2.0",
"#angular/core": "~8.2.0",
"#angular/forms": "~8.2.0",
"#angular/platform-browser": "~8.2.0",
"#angular/platform-browser-dynamic": "~8.2.0",
"#angular/router": "~8.2.0",
"#ng-bootstrap/ng-bootstrap": "^5.1.0",
"#types/socket.io-client": "^1.4.32",
"avatar-name-initials": "^2.0.5",
"bootstrap": "^4.3.1",
"express": "^4.17.1",
"ng2-file-upload": "^1.3.0",
"path": "^0.12.7",
"rxjs": "~6.4.0",
"rxjs-compat": "^6.5.4",
"socket.io-client": "^2.3.0",
"sweetalert2": "^8.16.1",
"time-ago-pipe": "^1.3.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.802.1",
"#angular/cli": "^8.3.0",
"#angular/compiler-cli": "^8.2.3",
"#angular/language-service": "~8.2.0",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"enhanced-resolve": "^3.3.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
Production Configuration
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
Note: If i turn aot and buildOptimizer to false, it works and no error is thrown.

Related

Nx 14.5.10 + Jest 27.5.1 Test suite failed to run EBUSY: resource busy or locked, open 'File Path'

I am migrating NX Monorepo from version 13 to 14 and everything works fine except the Jest migration, I am getting this error I've tried to remove the jest cache, nx cache, deleted the whole node_modules, and do a fresh install but nothing is working. Appreciate if anyone has gone through this issue or has any idea what is happening.
Thanks
When running the tests this is the error
FAIL lib-name libs/lib/src/lib-name/select-options-picker/select-options-picker.component.spec.ts
● Test suite failed to run
EBUSY: resource busy or locked, open 'C:\Users\User\AppData\Local\Temp\jest\ts-jest\c4\1501b067977ee4d35c48eb9ca4f97116c5dfef\e9a8ee471bc676fe755c57379268f21a1390a7a4'
at NgJestTransformer.TsJestTransformer.getCacheKey (../../node_modules/jest-preset-angular/node_modules/ts-jest/dist/ts-jest-transformer.js:245:40)
at ScriptTransformer._getCacheKey (../../node_modules/#jest/transform/build/ScriptTransformer.js:281:41)
at ScriptTransformer._getFileCachePath (../../node_modules/#jest/transform/build/ScriptTransformer.js:352:27)
at ScriptTransformer.transformSource (../../node_modules/#jest/transform/build/ScriptTransformer.js:595:32)
at ScriptTransformer._transformAndBuildScript (../../node_modules/#jest/transform/build/ScriptTransformer.js:765:40)
at ScriptTransformer.transform (../../node_modules/#jest/transform/build/ScriptTransformer.js:822:19)
This is my package.json
{
"name": "rsa",
"version": "0.0.1",
"license": "MIT",
"scripts": {
"ng": "nx",
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2020 browser module main",
"start": "ng serve --open",
"test": "nx test",
"test:coverage": "nx test --coverage --watch=false"
},
"private": true,
"dependencies": {
"#angular/animations": "14.1.3",
"#angular/cdk": "14.1.3",
"#angular/common": "14.1.3",
"#angular/compiler": "14.1.3",
"#angular/core": "14.1.3",
"#angular/flex-layout": "^10.0.0-beta.32",
"#angular/forms": "14.1.3",
"#angular/material": "14.1.3",
"#angular/material-moment-adapter": "14.1.3",
"#angular/platform-browser": "14.1.3",
"#angular/platform-browser-dynamic": "14.1.3",
"#angular/router": "14.1.3",
"#ngrx/effects": "14.0.2",
"#ngrx/entity": "14.0.2",
"#ngrx/router-store": "14.0.2",
"#ngrx/store": "14.0.2",
"#ngx-translate/core": "14.0.0",
"#ngx-translate/http-loader": "7.0.0",
"#nrwl/angular": "14.5.10",
"#storybook/core-server": "6.5.10",
"angular-2-local-storage": "^3.0.2",
"apexcharts": "^3.35.0",
"crypto-js": "3.3.0",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"highlight.js": "^10.4.1",
"jquery": "^3.5.1",
"keycloak-angular": "^8.0.1",
"keycloak-js": "^11.0.2",
"lodash-es": "^4.17.21",
"moment": "^2.29.3",
"ng-apexcharts": "^1.5.6",
"ng2-pdf-viewer": "^6.3.2",
"ngx-cookie-service": "^10.1.1",
"ngx-material-file-input": "^2.1.1",
"ngx-permissions": "^8.1.1",
"ngx-toastr": "^13.2.0",
"perfect-scrollbar": "1.5.0",
"postcss-loader": "^6.2.1",
"postcss-nested": "^5.0.6",
"postcss-nesting": "^8.0.1",
"postcss-preset-env": "7.5.0",
"postcss-scss": "^4.0.2",
"primeicons": "^5.0.0",
"primeng": "^11.4.5",
"rxjs": "7.5.6",
"simple-keyboard": "^2.29.67",
"tslib": "^2.3.1",
"zone.js": "0.11.4"
},
"devDependencies": {
"#angular-builders/custom-webpack": "^13.1.0",
"#angular-devkit/build-angular": "14.1.3",
"#angular-devkit/core": "14.1.3",
"#angular-eslint/eslint-plugin": "14.0.3",
"#angular-eslint/eslint-plugin-template": "14.0.3",
"#angular-eslint/template-parser": "14.0.3",
"#angular/cli": "~14.1.0",
"#angular/compiler-cli": "14.1.3",
"#angular/language-service": "14.1.3",
"#angularclass/hmr": "^3.0.0",
"#commitlint/cli": "^11.0.0",
"#ngrx/schematics": "14.0.2",
"#ngrx/store-devtools": "14.0.2",
"#nrwl/cli": "14.5.10",
"#nrwl/cypress": "14.5.10",
"#nrwl/eslint-plugin-nx": "14.5.10",
"#nrwl/jest": "14.5.10",
"#nrwl/linter": "14.5.10",
"#nrwl/storybook": "14.5.10",
"#nrwl/workspace": "14.5.10",
"#storybook/addon-actions": "^6.3.0",
"#storybook/addon-controls": "^6.4.1",
"#storybook/addon-docs": "^6.4.22",
"#storybook/addon-essentials": "6.5.10",
"#storybook/addon-knobs": "^6.3.0",
"#storybook/addon-postcss": "~2.0.0",
"#storybook/angular": "6.5.10",
"#storybook/builder-webpack5": "6.5.10",
"#storybook/manager-webpack5": "6.5.10",
"#types/angular-material": "^1.1.71",
"#types/crypto-js": "3.1.47",
"#types/highlight.js": "9.12.4",
"#types/jasmine": "4.0.3",
"#types/jasminewd2": "2.0.8",
"#types/jest": "27.4.1",
"#types/lodash-es": "4.17.3",
"#types/node": "14.14.33",
"#typescript-eslint/eslint-plugin": "5.29.0",
"#typescript-eslint/parser": "5.29.0",
"autoprefixer": "^10.4.0",
"barrelsby": "^2.2.0",
"codelyzer": "6.0.0-next.1",
"comment-json": "^4.1.0",
"commitizen": "^4.2.2",
"commitlint-config-cz": "^0.13.2",
"conventional-changelog-cli": "2.1.1",
"cross-env": "^7.0.3",
"cypress": "^9.5.4",
"cz-customizable": "^6.3.0",
"dotenv": "10.0.0",
"eslint": "8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-cypress": "^2.10.3",
"html-webpack-plugin": "^5.5.0",
"husky": "^4.2.5",
"jasmine-core": "4.2.0",
"jasmine-marbles": "~0.8.3",
"jasmine-spec-reporter": "7.0.0",
"jest": "27.5.1",
"jest-canvas-mock": "^2.2.0",
"jest-preset-angular": "11.1.2",
"lint-staged": "^10.2.11",
"lodash": "^4.17.19",
"ng-packagr": "14.1.0",
"nx": "14.5.10",
"postcss": "^8.4.4",
"postcss-import": "14.1.0",
"postcss-url": "10.1.3",
"prettier": "2.6.2",
"protractor": "7.0.0",
"sass": "^1.44.0",
"stylelint": "^13.9.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0",
"tailwindcss": "^2.2.16",
"ts-jest": "27.1.4",
"ts-node": "10.9.1",
"typescript": "4.7.4",
"webpack": "^5.50.0",
"webpack-bundle-analyzer": "^4.4.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged --concurrent false",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"docs/**/*.md": [
"node docs/check-kb-labels",
"node docs/check-dead-links fast",
"node docs/check-documentation-overview",
"node docs/check-sentence-newline"
],
"*.{scss,css}": [
"stylelint --fix"
],
"*": [
"prettier --loglevel warn --write"
],
"*.ts": [
"jest --ci --bail --findRelatedTests --detectOpenHandles"
]
},
"commitlint": {
"extends": [
"cz"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
}
},
"postinstall": {
"jest-extended/types": "copy node_modules/#types/jest-extended"
}
}
Jest.preset.js
const nxPreset = require('#nrwl/jest/preset').default;
module.exports = {
...nxPreset,
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
// resolver: '#nrwl/jest/plugins/resolver',
testRunner: 'jest-jasmine2',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
moduleNameMapper: {
'^lodash-es$': 'lodash',
},
};
Jest.config.ts
/* eslint-disable */
export default {
displayName: 'donor-ui',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
coverageDirectory: '../../coverage/apps/donor-ui',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};

Unable to run angular application using ng server getting Module not found

I unzipped a angular application and did a npm install it worked well and later did ng serve but when i did i got the below issue
I install node-sass and cleared node cache also and deleted node_nodules & deleted package-lock.json and re installed again issue still persists.
I am using primeng 8.0,boostrap5.1.1,angular8,gojs
local development setup info using
Angular 12 , Node 14
angular.json
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/draggableLinks",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.css",
"./node_modules/primeicons/primeicons.css",
"./node_modules/primeng/resources/themes/saga-blue/theme.css",
"./node_modules/primeng/resources/primeng.min.css",
"src/styles.css"
],
"scripts": []
},
package.json
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "~8.2.3",
"#angular/common": "~8.2.3",
"#angular/compiler": "~8.2.3",
"#angular/core": "~8.2.3",
"#angular/forms": "~8.2.3",
"#angular/platform-browser": "~8.2.3",
"#angular/platform-browser-dynamic": "~8.2.3",
"#angular/router": "~8.2.3",
"bootstrap": "^5.1.1",
"gojs": "^2.0.16",
"primeicons": "^4.1.0",
"primeng": "^8.0.0",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.803.0",
"#angular/cli": "~8.3.0",
"#angular/compiler-cli": "~8.2.3",
"#angular/language-service": "~8.2.3",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
Try modifying stylesheet urls in angular.json by removing './' as below.
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.css",
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/saga-blue/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"src/styles.css"
]

Angular 9 Application not loading in IE11

I am facing an issue where my app is not loading in IE 11 after adding ngx-treeview.
I am getting the following error(SCRIPT1002: Syntax error),
Script Error
Error point in vendor.js
I am not sure how to resolve this issue. The application runs fine in chrome and firefox but in IE11 I only see Loading... . I couldn't find browser compatibility on the library github page. Should I give up on using this library or there is a way to fix this issue.
The package.json file is
"scripts": {
"ng": "ng",
"start": "ng serve --extract-css",
"build": "ng build --extract-css",
"build:ssr": "npm run build -- --app=ssr --output-hashing=media",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"#angular-slider/ngx-slider": "^2.0.3",
"#angular/animations": "^9.1.13",
"#angular/common": "^9.1.13",
"#angular/compiler": "^9.1.13",
"#angular/core": "^9.1.13",
"#angular/forms": "^9.1.13",
"#angular/platform-browser": "^9.1.13",
"#angular/platform-browser-dynamic": "^9.1.13",
"#angular/platform-server": "^9.1.13",
"#angular/router": "^9.1.13",
"#fortawesome/fontawesome-free": "^5.15.3",
"#ng-select/ng-select": "4.0.4",
"angular-polyfills": "^1.0.1",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^4.6.0",
"btoa": "^1.2.1",
"classlist.js": "^1.1.20150312",
"console-polyfill": "^0.3.0",
"core-js": "^2.4.1",
"hidden-attribute-polyfill": "^0.1.0",
"ie9-oninput-polyfill": "^1.1.1",
"jquery": "^3.4.1",
"ngx-bootstrap": "^6.2.0",
"ngx-infinite-scroll": "^9.1.0",
"ngx-treeview": "^10.0.2",
"node-sass": "^4.14.1",
"responsive-toolkit": "^2.6.3",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.0.0-rc.0",
"tslib": "^1.10.0",
"web-animations-js": "^2.3.2",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.901.13",
"#angular/cli": "^9.1.13",
"#angular/compiler-cli": "^9.1.13",
"#angular/language-service": "^9.1.13",
"#types/jasmine": "~2.8.3",
"#types/jasminewd2": "~2.0.2",
"#types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~3.8.3"
},
"optionalDependencies": {}
}}```
and tsconfig.json is
```{
"compileOnSave": false,
"compilerOptions": {
"downlevelIteration": true,
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/#types"
],
"lib": [
"es2017",
"dom"
],
"module": "esnext",
"baseUrl": "./"
}
}
In browserslist file, modify not IE 9-11 to IE 9-11
In tsconfig.json file, modify "target": "es2015"to "target": "es5"

ERROR Error: Angular JIT compilation failed: '#angular/compiler' not loaded

The Error I got suddenly while running my app in a development environment using VSCode,
main.js:7740 ERROR Error: Angular JIT compilation failed: '#angular/compiler' not loaded!
- JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
- Did you bootstrap using '#angular/platform-browser-dynamic' or '#angular/platform-server'?
- Alternatively provide the compiler with 'import "#angular/compiler";' before bootstrapping.
at getCompilerFacade (vendor.js:20189)
at Function.get (vendor.js:33871)
at getInjectableDef (vendor.js:19941)
at resolveNgModuleDep (vendor.js:47812)
at NgModuleRef_.get (vendor.js:48688)
at resolveDep (vendor.js:49213)
at createClass (vendor.js:49071)
at createDirectiveInstance (vendor.js:48882)
at createViewNodes (vendor.js:60498)
at callViewAction (vendor.js:60948)
Also got an error saying
Angular extension might not work correctly because ngcc operation failed. Try to invoke ngcc manually by running 'npm/yarn run ngcc'. Please see the extension output for more information.
Package.json contains below
{
"name": "dxfsuite",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o --proxy-config proxy.conf.json --port 4200",
"build": "ng build",
"build-prod": "ng build --prod --stats-json --source-map=false",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular-devkit/schematics-cli": "^0.901.14",
"#angular/animations": "~9.0.0",
"#angular/cdk": "^9.1.0",
"#angular/common": "~9.0.0",
"#angular/compiler": "~9.0.0",
"#angular/core": "~9.0.0",
"#angular/forms": "~9.0.0",
"#angular/localize": "^9.1.13",
"#angular/platform-browser": "~9.0.0",
"#angular/platform-browser-dynamic": "~9.0.0",
"#angular/router": "~9.0.0",
"#elastic/apm-rum-angular": "^0.5.0",
"#fullcalendar/angular": "^4.4.5-beta",
"#fullcalendar/core": "^4.4.0",
"#fullcalendar/daygrid": "^4.4.0",
"#fullcalendar/timegrid": "^4.4.0",
"#ionic/angular": "^5.5.4",
"#ng-bootstrap/ng-bootstrap": "^6.0.0",
"#ng-select/ng-select": "^3.7.2",
"#swimlane/ngx-charts": "^13.0.2",
"#types/jquery": "^3.5.5",
"angular-feather": "^6.1.0",
"apexcharts": "^3.25.0",
"bootstrap": "^4.6.0",
"bootstrap-daterangepicker": "^3.0.5",
"bootstrap-tagsinput": "^0.7.1",
"daterangepicker": "^3.0.5",
"install-peers": "^1.0.3",
"jquery": "^3.4.1",
"jqueryui": "^1.11.1",
"loadash": "^1.0.0",
"lodash": "^4.17.15",
"moment": "^2.26.0",
"moment-timezone": "^0.5.33",
"ng-apexcharts": "^1.5.8",
"ng-zorro-antd": "^9.0.0-beta.0",
"ng2-daterangepicker": "^2.0.12",
"ngx-filesize": "^2.0.13",
"ngx-perfect-scrollbar": "^8.0.0",
"ngx-sortablejs": "^3.1.4",
"ngx-spinner": "^10.0.1",
"peity": "^3.3.0",
"popper.js": "^1.16.1",
"ramda": "^0.26.1",
"rxjs": "^6.5.4",
"service-worker": "0.0.0",
"sortablejs": "^1.13.0",
"tslib": "^1.10.0",
"videogular2": "^7.0.2",
"vivus": "^0.4.5",
"web-push": "^3.4.3",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.900.1",
"#angular/cli": "~9.0.1",
"#angular/compiler-cli": "~9.0.0",
"#angular/language-service": "~9.0.0",
"#ionic/angular-toolkit": "^3.1.0",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.20.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.4.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.7.5"
}
}
and itsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/#types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
Searched many forums to get this resolved. But nothing is helpful for me.
please help
For me is caused by the Angular Language Service extension.
Enabled legacy view-engine in the extension setting
Delete node_modules folder (npx rimraf node_modules)
Run npm install
Edit: should have fixed in this commit.

Service worker available event not fired with angular 7

I have created application in angular 7 with PWA support. In which, I have created new update popup with swUpdate. Earlier its working proper and show me new update popup once I have upload new build on server. But, its not working.
Here in my code.
constructor() {
this.swUpdate.available.subscribe(event => {
console.log(event);
this.promptUser();
});
if (this.swUpdate.isEnabled) {
interval(2 * 60 * 60).subscribe(() => this.swUpdate.checkForUpdate()
.then(() => console.log('checking for updates')));
}
}
promptUser() {
this.swUpdate.activateUpdate().then(() => {
location.reload();
});
}
Here is my package.json file
{
"name": "app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod --configuration=dev",
"build:dev": "ng build --prod --configuration=dev",
"build:staging": "ng build --prod --configuration=staging",
"build:prod": "ng build --prod --configuration=production",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^7.2.9",
"#angular/cdk": "^7.3.1",
"#angular/common": "^7.2.3",
"#angular/compiler": "^7.2.3",
"#angular/core": "^7.2.3",
"#angular/fire": "^5.1.1",
"#angular/flex-layout": "^7.0.0-beta.24",
"#angular/forms": "^7.2.3",
"#angular/http": "^7.2.3",
"#angular/material": "^7.3.1",
"#angular/platform-browser": "^7.2.3",
"#angular/platform-browser-dynamic": "^7.2.3",
"#angular/pwa": "^0.10.7",
"#angular/router": "^7.2.3",
"#angular/service-worker": "^7.2.3",
"#ng-bootstrap/ng-bootstrap": "^4.0.2",
"angular-font-awesome": "^3.1.2",
"angular-moment-timezone": "^1.7.1",
"angular2-cookie": "^1.2.6",
"angular2-cookie-law": "^6.2.0",
"angular2-toaster": "^7.0.0",
"angular7-data-table": "^1.0.13",
"bootstrap": "^4.2.1",
"core-js": "^2.6.3",
"exceljs": "^2.0.1",
"file-saver": "^2.0.2",
"firebase": "^5.8.3",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"jw-angular-social-buttons": "^1.0.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"ng-connection-service": "^1.0.4",
"ng-http-loader": "^3.2.0",
"ng-recaptcha": "^4.2.1",
"ng2-validation": "^4.2.0",
"ng6-toastr-notifications": "^1.0.4",
"ngx-cookie-service": "^2.1.0",
"ngx-infinite-scroll": "^6.0.1",
"ngx-slick": "^0.2.1",
"ngx-slick-carousel": "^0.4.4",
"node-sass": "^4.13.0",
"rxjs": "^6.4.0",
"rxjs-compat": "^6.4.0",
"slick-carousel": "^1.8.1",
"stylelint": "^9.10.1",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.10.7",
"#angular/cli": "^7.3.0",
"#angular/compiler-cli": "^7.2.3",
"#angular/language-service": "^7.2.3",
"#types/jasmine": "^2.8.16",
"#types/jasminewd2": "^2.0.6",
"#types/moment": "^2.13.0",
"#types/node": "^12.0.2",
"codelyzer": "~4.2.1",
"husky": "^1.3.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~3.1.6"
},
"browser": {
"fs": false,
"path": false,
"os": false,
"crypto": false,
"stream": false,
"http": false,
"tls": false,
"zlib": false,
"https": false,
"net": false
}
}
Please let me know if any have have any suggestions on this. Its really needs.

Categories

Resources