Skip to content

stylePreprocessorOptions not work in version 19.6.0 #29657

Closed as not planned
Closed as not planned
@Congchuabongbong

Description

@Congchuabongbong

Current Behavior

I want to configure relative paths for global styles. But it seems it doesn't work. I tried on a project created directly from angular and it still works fine and my old project using nx-workspace version 16.1.0 still works fine.
I have configured the project.json file like so:
Image
My folder structure is like so:
Image
and then i used in file styles.scss like so:

Image
and it gave an error:

Image

Expected Behavior

A relative path works
@import '../styles/_variables.scss';
this should works as well
@import '_variables.scss';

GitHub Repo

No response

Steps to Reproduce

Nx Report

{
    "name": "bravo-web-portal",
    "$schema": "../../node_modules/nx/schemas/project-schema.json",
    "projectType": "application",
    "prefix": "app",
    "sourceRoot": "apps/bravo-web-portal/src",
    "tags": [],
    "targets": {
        "build": {
            "executor": "@angular-devkit/build-angular:application",
            "outputs": ["{options.outputPath}"],
            "options": {
                "outputPath": "dist/apps/bravo-web-portal",
                "index": "apps/bravo-web-portal/src/index.html",
                "browser": "apps/bravo-web-portal/src/main.ts",
                "polyfills": ["zone.js"],
                "tsConfig": "apps/bravo-web-portal/tsconfig.app.json",
                "inlineStyleLanguage": "scss",
                "assets": [
                    {
                        "glob": "**/*",
                        "input": "apps/bravo-web-portal/public"
                    }
                ],
                "styles": ["apps/bravo-web-portal/src/styles.scss"],
                "stylePreprocessorOptions": {
                    "includePaths": ["src/styles"]
                },
                "scripts": []
            },
            "configurations": {
                "production": {
                    "budgets": [
                        {
                            "type": "initial",
                            "maximumWarning": "500kb",
                            "maximumError": "1mb"
                        },
                        {
                            "type": "anyComponentStyle",
                            "maximumWarning": "2kb",
                            "maximumError": "4kb"
                        }
                    ],
                    "outputHashing": "all"
                },
                "development": {
                    "optimization": false,
                    "extractLicenses": false,
                    "sourceMap": true
                }
            },
            "defaultConfiguration": "production"
        },
        "serve": {
            "executor": "@angular-devkit/build-angular:dev-server",
            "configurations": {
                "production": {
                    "buildTarget": "bravo-web-portal:build:production"
                },
                "development": {
                    "buildTarget": "bravo-web-portal:build:development"
                }
            },
            "defaultConfiguration": "development"
        },
        "extract-i18n": {
            "executor": "@angular-devkit/build-angular:extract-i18n",
            "options": {
                "buildTarget": "bravo-web-portal:build"
            }
        },
        "lint": {
            "executor": "@nx/eslint:lint"
        },
        "test": {
            "executor": "@nx/jest:jest",
            "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
            "options": {
                "jestConfig": "apps/bravo-web-portal/jest.config.ts"
            }
        }
    }
}

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions