简体   繁体   English

如何将参数传递给自定义Angular webpack构建?

[英]How to pass arguments to custom Angular webpack build?

I'm using Angular 7.2.1 and @angular-builders/custom-webpack:browser for build of my application. 我正在使用Angular 7.2.1和@angular-builders/custom-webpack:browser来构建我的应用程序。 I want to pass some arguments to the webpack.config.js file. 我想将一些参数传递给webpack.config.js文件。 When I am writing ng serve or npm start I'd like to add something like --env=testing parameter and then have this value available in my webpack.config.js . 当我编写ng servenpm start我想添加类似--env=testing参数的内容,然后在我的webpack.config.js提供此值。 How can I achieve that? 我怎样才能做到这一点?

它可以简单地通过这种方式传递:

ENV=testing npm run build

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM