0

I have an Angular app, is there a way that I can force Angular to deploy the main.js under /assets folder?

basically I want to make Angular-CLI compile main.ts to main.js in assets folder.

"build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/myprofile",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.app.json",
        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [              
          "src/styles.scss"
        ]
      },
      "configurations": {
        "production": {
          "assets": [
            {
              "glob": "**/*",
              "input": "src/assets",
              "output": "/assets/",
              "ignore": [
                "appConfig.dev.json"
              ]
            },
            {
              "glob": "favicon.ico",
              "input": "src/",
              "output": "/"
            }
          ]
fereshteh rabet
  • 198
  • 1
  • 2
  • 11

1 Answers1

-1

You have to change other property.

"outputPath": "/assets",

this shows angular where output should be placed

Xalion
  • 623
  • 9
  • 27
  • I don't want to put everything in the assets folder. This will create an assets folder and compile and build everything in that folder. I only want to build the js files in the assets folder – fereshteh rabet Aug 05 '22 at 15:54
  • u can extend npm script `npm build :"ng build ... && cp dist/main.js ./assets"` – Xalion Aug 05 '22 at 15:56