Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change path for build project in angular?

Here my project name is angulardemo so I build project using this command

ng build --prod --base-href /angulardemo/

so this command build project and create dist folder and inside dist folder create anglulardemo named folder and inside angulardemo folder create below files

3rdpartylicenses.txt
favicon.ico
index.html
main.95e7fd4eb2e659e65554.js
polyfills.1ef83d22ada557f4a131.js
runtime.ec2944dd8b20ec099bf3.js
styles.3ff695c00d717f2d2a11.css

but I want to create this files directly in dist folder don't want create angulardemo folder inside dist folder how It is possible ?

like image 886
Dharmesh Avatar asked Feb 05 '26 02:02

Dharmesh


2 Answers

You can change output path in angular.json

{
 "projects": {
   "my-app-name": {
    "architect": {
     "options": {
       "outputPath": "dist", <-----here
like image 188
Nenad Radak Avatar answered Feb 09 '26 09:02

Nenad Radak


With the new version of angular (v6+) and the angular CLI it goes inside the dist directory/yourproject by default.

Although you can change build options inside angular.json:

"architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
like image 28
nircraft Avatar answered Feb 09 '26 08:02

nircraft



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!