Search code examples
javascriptangulartypescriptbundling-and-minification

How to bundle js files in "dist" folder (angular 7)?


I am running an angular 7 web application that has a dist folder with bunch of java script files that are not bundled. I would like to bundle all the java script file inside the dist folder in one java script file to minimize the http request when I load my web page

I have tried the following:

npm run build --aot --buildOptimizer --prod

I am expecting to see bundled files in dist folder


Solution

  • Your files will not be bundled to a single file. At least several files will be available like main.js, vendor.js etc.

    However, if you want to pass building options like --aot you have to run

    ng build --aot --prod
    

    npm run build will run exactly the command defined in package.json.