在构建之后,我在/ dist文件夹中获取了捆绑文件,我在php文件中动态加载,如下所示:
var inline = document.createElement('script');
var polyfills = document.createElement('script');
var styles = document.createElement('script');
var vendor = document.createElement('script');
var main = document.createElement('script');
inline.async = false;
polyfills.async = false;
styles.async = false;
vendor.async = false;
main.async = false;
inline.src = ./dist/inline.bundle.js";
polyfills.src = ./dist/polyfills.bundle.js";
styles.src = ./dist/styles.bundle.js";
vendor.src = ./dist/vendor.bundle.js";
main.src = ./dist/main.bundle.js";
document.head.appendChild(inline);
document.head.appendChild(polyfills);
document.head.appendChild(styles);
document.head.appendChild(vendor);
document.head.appendChild(main);
但是如果我使用ng build --prod我的dev包被删除并被其他的替换。是否有一些选项可以保留两种类型的包,例如一个文件夹 - / dist_prod运行ng build --prod命令,第二个是/ dist for dev version?
答案 0 :(得分:0)
当然,请使用output-path
标志
ng build --prod -op ./dist_prod
ng build -op ./dist_dev