[英]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. 我正在运行一个angular 7 Web应用程序,该应用程序的dist文件夹中有未捆绑的Java脚本文件。 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 我想在加载网页时将dist文件夹内的所有Java脚本文件捆绑到一个Java脚本文件中,以最大程度地减少http请求
I have tried the following: 我尝试了以下方法:
npm run build --aot --buildOptimizer --prod
I am expecting to see bundled files in dist folder 我期望在dist文件夹中看到捆绑的文件
Your files will not be bundled to a single file. 您的文件不会捆绑到一个文件中。 At least several files will be available like main.js
, vendor.js
etc. 至少有几个文件可用,例如main.js
, vendor.js
等。
However, if you want to pass building options like --aot
you have to run 但是,如果要传递--aot
等构建选项,则必须运行
ng build --aot --prod
npm run build
will run exactly the command defined in package.json
. npm run build
将完全运行package.json
定义的命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.