简体   繁体   English

如何在“ dist”文件夹(角度7)中捆绑js文件?

[英]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.jsvendor.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.

相关问题 如何将CSS文件从源文件夹捆绑和复制到dist文件夹? - How to bundle and copy CSS files from source folder to dist folder? 如何在Webpack中构建dist文件夹后,将bundle.js和css文件移动到statics文件夹中? - How after building the dist folder in Webpack, move the bundle.js and css file into the statics folder? Angular构建文件未捆绑在dist文件夹中 - Angular build files not bundling in dist folder angular gulp-如何根据每个src文件夹拆分dist文件夹中的js文件 - angular gulp - how to split js file in dist folder according to each src folder dist /文件夹中的JS文件与root文件夹中的JS文件有什么区别? - What is the difference between JS files in dist/ folder and the one in root? Angular Cli Webpack,如何添加或捆绑外部 js 文件? - Angular Cli Webpack, How to add or bundle external js files? dist文件中的错误Angular 2 - Error in dist files Angular 2 如何准备grunt以使用app.js准备dist文件夹? - How to prepare grunt to prepare dist folder with app.js? 如何在 angular4 应用程序中捆绑资产文件夹? - How to bundle asset folder in angular4 app? Gulp.js缩小,丑化和复制所有文件,但dist文件夹中的应用仍然无法正常工作 - Gulp.js minifies, uglifies and copies all the files but still the app in the dist folder doesn't work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM