Including Web.config While Taking Build in Angular 15 or Less

To Include Web.config file in dest folder while taking build in Angular, you can modify the angular.json file as follows:

Angular.Json

(Note: We need to include Web.config file inside the src folder.)

In build declaration, we can define the web config inside the block of assets.

   "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets", 
              "src/web.config"
            ],
            "styles": [
              "src/styles.scss"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js"
            ]
          }
         
        },

Another Way

In build declaration inside the asset block we can define the we.config with input and output.

 { 
"assests":{
"src/web.config",
              {
                "glob": "**/*",
                "input": "node_modules/ng2-pdfjs-viewer/pdfjs",
                "output": "assets/pdfjs"
              },
...
...
...
}
}


Similar Articles