You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser

Discussão em 'Angular' iniciado por Jade, Dezembro 22, 2024.

  1. Jade

    Jade Guest

    I've recently updated from Angular 11 to Angular 12 and have got issues with parsing the CSS. I've followed each of the options from the following:

    You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser after Angular 12 update

    I've added this to my optimization within my angular.json file.

    "optimization": {
    "scripts": true,
    "styles": {
    "minify": false,
    "inlineCritical": false
    },
    "fonts": true
    },


    I've added

    "inlineStyleLanguage": "scss"

    As my default style language.

    And I'm still getting the following error for each of my scss files: [​IMG]

    I've included my angular.json file for info incase I'm missing anything:

    {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
    "portal": {
    "root": "",
    "sourceRoot": "src",
    "projectType": "application",
    "prefix": "app",
    "schematics": {
    "@schematics/angular:component": {
    "style": "scss"
    },
    "@schematics/angular:application": {
    "strict": true
    }
    },
    "architect": {
    "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
    "allowedCommonJsDependencies": [
    "lodash",
    "@firebase/database",
    "angular2-chartjs",
    "@ant-design/colors",
    "@ant-design/icons-angular",
    "@ant-design/icons-angular/icons"
    ],
    "aot": true,
    "outputPath": "dist",
    "index": "src/index.html",
    "main": "src/main.ts",
    "polyfills": "src/polyfills.ts",
    "tsConfig": "src/tsconfig.app.json",
    "inlineStyleLanguage": "scss",
    "assets": [
    "src/favicon.ico",
    "src/assets"
    ],
    "styles": [
    "./node_modules/ng-zorro-antd/style/entry.less",
    "src/app/components/kit/vendors/antd/themes/default.less",
    "src/app/components/kit/vendors/antd/themes/dark.less",
    "./node_modules/bootstrap/dist/css/bootstrap.min.css",
    "./node_modules/chartist/dist/chartist.css",
    "./node_modules/quill/dist/quill.core.css",
    "./node_modules/quill/dist/quill.bubble.css",
    "./node_modules/quill/dist/quill.snow.css",
    "./node_modules/c3/c3.min.css",
    "src/global.scss",
    "src/app/layouts/Auth/auth.component.scss"
    ],
    "scripts": [
    "./node_modules/c3/c3.min.js"
    ]
    },
    "configurations": {
    "production": {
    "fileReplacements": [
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.prod.ts"
    }
    ],
    "optimization": {
    "scripts": true,
    "styles": {
    "minify": false,
    "inlineCritical": false
    },
    "fonts": true
    },
    "outputHashing": "all",
    "sourceMap": false,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": false,
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "2mb",
    "maximumError": "10mb"
    }
    ]
    },
    "hmr": {
    "fileReplacements": [
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.hmr.ts"
    }
    ],
    "optimization": {
    "scripts": true,
    "styles": {
    "minify": false,
    "inlineCritical": false
    },
    "fonts": true
    },
    "outputHashing": "all",
    "sourceMap": false,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": false,
    },
    "demo": {
    "fileReplacements": [
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.demo.ts"
    }
    ],
    "optimization": {
    "scripts": true,
    "styles": {
    "minify": false,
    "inlineCritical": false
    },
    "fonts": true
    },
    "outputHashing": "all",
    "sourceMap": false,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": false
    }
    }
    },
    "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
    "aot": true,
    "browserTarget": "portal:build"
    },
    "configurations": {
    "production": {
    "browserTarget": "portal:build:production"
    },
    "hmr": {
    "browserTarget": "portal:build:hmr",
    "hmr": true
    },
    "demo": {
    "browserTarget": "portal:build:demo"
    }
    }
    },
    "extract-i18n": {
    "builder": "@angular-devkit/build-angular:extract-i18n",
    "options": {
    "browserTarget": "portal:build"
    }
    },
    "test": {
    "builder": "@angular-devkit/build-angular:karma",
    "options": {
    "main": "src/test.ts",
    "polyfills": "src/polyfills.ts",
    "tsConfig": "src/tsconfig.spec.json",
    "karmaConfig": "src/karma.conf.js",
    "inlineStyleLanguage": "scss",
    "styles": [
    "src/styles.scss"
    ],
    "scripts": [],
    "assets": [
    "src/favicon.ico",
    "src/assets"
    ]
    }
    },
    "lint": {
    "builder": "@angular-devkit/build-angular:tslint",
    "options": {
    "tsConfig": [
    "src/tsconfig.app.json",
    "src/tsconfig.spec.json"
    ],
    "exclude": [
    "**/node_modules/**"
    ]
    }
    }
    }
    },
    "portal-e2e": {
    "root": "e2e/",
    "projectType": "application",
    "prefix": "",
    "architect": {
    "e2e": {
    "builder": "@angular-devkit/build-angular:protractor",
    "options": {
    "protractorConfig": "e2e/protractor.conf.js",
    "devServerTarget": "portal:serve"
    },
    "configurations": {
    "production": {
    "devServerTarget": "portal:serve:production"
    }
    }
    },
    "lint": {
    "builder": "@angular-devkit/build-angular:tslint",
    "options": {
    "tsConfig": "e2e/tsconfig.e2e.json",
    "exclude": [
    "**/node_modules/**"
    ]
    }
    }
    }
    }
    },
    "defaultProject": "portal",
    "cli": {
    "analytics": "c2ed9326-a5b8-4009-9392-6be3b6fcfd3c"
    }
    }

    Continue reading...

Compartilhe esta Página