In my Angular project assets folder not include in my webpack

Discussão em 'Angular' iniciado por ousmane MBINTE, Abril 10, 2025.

  1. I have an Angular 19 project and I have an issue relating of images stoked in my assets folder. In this folder I have my icons and the svg-country-flags, but when I launch my project using ng serve I get a http 404 on all icons of the application in the console and when I check my sources in Chrome I don't see the assets folder under the src folder. You could see bellow in my angular.json that I defined the assets.

    {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
    "omb-frontend": {
    "projectType": "application",
    "schematics": {
    "@schematics/angular:component": {
    "style": "scss"
    }
    },
    "root": "",
    "sourceRoot": "src",
    "prefix": "app",
    "architect": {
    "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
    "outputPath": "dist/omb-frontend",
    "index": "src/index.html",
    "main": "src/main.ts",
    "polyfills": ["zone.js"],
    "tsConfig": "tsconfig.app.json",
    "inlineStyleLanguage": "scss",
    "assets": [
    "src/favicon.ico",
    "src/assets"
    ],
    "styles": [
    "@angular/material/prebuilt-themes/cyan-orange.css",
    "src/styles.scss"
    ],
    "scripts": []
    },
    "configurations": {
    "production": {
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "500kB",
    "maximumError": "1MB"
    },
    {
    "type": "anyComponentStyle",
    "maximumWarning": "4kB",
    "maximumError": "8kB"
    }
    ],
    "outputHashing": "all"
    },
    "development": {
    "optimization": false,
    "extractLicenses": false,
    "sourceMap": true
    }
    },
    "defaultConfiguration": "production"
    },
    "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "configurations": {
    "production": {
    "buildTarget": "omb-frontend:build:production"
    },
    "development": {
    "buildTarget": "omb-frontend:build:development"
    }
    },
    "defaultConfiguration": "development"
    },
    "extract-i18n": {
    "builder": "@angular-devkit/build-angular:extract-i18n"
    },
    "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": [
    "@angular/material/prebuilt-themes/cyan-orange.css",
    "src/styles.scss"
    ],
    "scripts": []
    }
    }
    }
    }
    }
    }


    This is structuration of my src folder

    src
    ├── app
    └── assets
    ├── images
    │ ├── authentication
    │ │ ├── facebook.svg
    │ │ ├── google.svg
    │ │ ├── img-auth-bg.svg
    │ │ └── twitter.svg
    │ ├── favicon.svg
    │ └── logo-omb.svg
    └── svg-country-flags
    └── .gitkeep


    the header

    <header class="header">
    <div class="logo">
    <img src="assests/images/logo-omb.svg" alt="theme-logo"/>
    </div>
    <nav class="main-nav">
    <a routerLink="/profile" class="profile">Profil</a>
    <a routerLink="/login" class="login">Login</a>
    <a routerLink="/register" class="register">Register</a>
    </nav>
    </header>

    Continue reading...

Compartilhe esta Página