I am facing an issue while upgrading my project from angular 8.2.1 to angular 13 version.
After a successful upgrade while preparing a build it is giving me the following error.
Data path "" must NOT have additional properties(extractCss).
I already renamed styleext
with style
in the angular.json file, but still not able to find the root cause for this error.
angular.json file is as follows.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"qiwkCollaborator": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
/* "configurations": {
"fr": {
"aot": true,
"outputPath": "dist/qwikCollaborator/fr/",
"i18nFile": "src/translate/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
},
"en": {
"aot": true,
"outputPath": "dist/qwikCollaborator/en/",
"i18nFile": "src/translate/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error"
}
},*/
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/qiwkCollaborator",
"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": [
"src/styles.scss",
"src/assets/css/custom-mobile.css",
"src/assets/css/custom.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"src/assets/js/qwikCollaborator.js"
]
},
"configurations": {
"es5": {
"tsConfig": "./tsconfig.es5.json"
},
"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"
}
]
}
}
},
"serve": {
/* "configurations": {
"fr": {
"browserTarget": "qwikCollaborator:build:fr"
},
"en": {
"browserTarget": "qwikCollaborator:build:en"
} ,
},*/
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "qiwkCollaborator:build"
},
"configurations": {
"es5": {
"browserTarget": "qiwkCollaborator:build:es5"
},
"production": {
"browserTarget": "qiwkCollaborator:build:es5"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "qiwkCollaborator: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": [
"src/styles.scss"
],
"scripts": ["../node_modules/jspdf/dist/jspdf.min.js"]
}
},
"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": "qiwkCollaborator:serve"
},
"configurations": {
"production": {
"devServerTarget": "qiwkCollaborator:serve:production"
}
}
}
}
}},
"defaultProject": "qiwkCollaborator"
}
How to get rid of this additional property?
can anyone help me with this?
thanks in advance!
Just remove the "extractCss": true
from your production environment, it will resolve the problem.
The reason about it is extractCss is deprecated, and it's value is true by default. See more here: Extracting CSS into JS with Angular 11 (deprecated extractCss)