Skip to content

Cannot exclude folders or files from assets V17.2 #27286

Description

@wonaGuillermo

Which @angular/* package(s) are the source of the bug?

compiler-cli, compiler

Is this a regression?

Yes

Description

Hello everyone! I am writing because I have the following problem when compiling my project with ng build, I cannot exclude folders or files from assets.

I have a folder "scss" that contains the style.scss and other .scss files but when compiling the project it leaves the scss files in the "assets" folder of the project for production.

I tried to modify the angular.json file but without success, has anyone else gone through the same thing? is it that you can not put such files in assets? I do it as a way to organize my code but maybe I'm making a mistake.

I am using angular 17.2.

I leave my angular.json file

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "buffetQR": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss",
          "standalone": false
        },
        "@schematics/angular:directive": {
          "standalone": false
        },
        "@schematics/angular:pipe": {
          "standalone": false
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            "outputPath": "dist/buffet-qr",
            "index": "src/index.html",
            "browser": "src/main.ts",
            "polyfills": [
              "zone.js"
            ],
            "tsConfig": "tsconfig.app.json",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets/"
              },
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets/",
                "ignore": ["**/scss/**"]
              }
            ],
            "styles": [
              "src/assets/scss/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "5mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "5mb",
                  "maximumError": "5mb"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "optimization": false,
              "extractLicenses": false,
              "sourceMap": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.development.ts"
                }
              ]
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "buildTarget": "buffetQR:build:production"
            },
            "development": {
              "buildTarget": "buffetQR:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "buildTarget": "buffetQR:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "polyfills": [
              "zone.js",
              "zone.js/testing"
            ],
            "tsConfig": "tsconfig.spec.json",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/assets/scss/styles.scss"
            ],
            "scripts": []
          }
        }
      }
    }
  }
}

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

I have no error in console, it simply does not exclude the folder.

Please provide the environment you discovered this bug in (run ng version)

Angular 17.2
NodeJS: 18.13.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions