Skip to content

@angular-devkit/build-angular:browser - Ability to build app as a single bundle #23574

@dinbtechit

Description

@dinbtechit

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

Ability to build app as a single bundle.

Describe the solution you'd like

angular.json: projects -> "project-name" -> architect -> build -> Configuration: (new Options to bundling the js as single output)

. . 

"architect": {
 "build": {
     "options": {
         "scripts": [
            {
               "input": "custom-script1.js",
               "bundleName": "my-custom-script1"
             },
              {
               "input": "custom-script2.js",
               "bundleName": "my-custom-script2"
              }
            ]
       },
       "configuration" : {
       "production" : {
           "singleBundle": {
               "path": "dist/project-name/"
               "name": "single-bundle"   <<---<<< // Single js bundle contains (runtime.js, main.js, polyfills.js, custom-script1.js, custom-script2.js)
           }
        }
      }
  }
. . .

Usage:

ng build project-name

Output expected:

  1. Dist folder
    dist/single-bundle.js
    dist/runtime.js
    dist/main.js
    dist/polyfill.js
    index.html
    . . .
    
  2. Index.html to include the single-bundle.js
    <script src="single-bundle.js" type="module"></script>
    

Describe alternatives you've considered

  1. ngx-build-plus does provide the ability to build as a single file. It would be nice if angular devkit can provide this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions