gpt4 book ai didi

javascript - Vue staging build 创建一个开发构建而不是生产

转载 作者:行者123 更新时间:2023-12-02 16:24:02 25 4
gpt4 key购买 nike

Vue documentation :

vue-cli-service build --mode staging builds a production app instaging mode, using .env, .env.staging and .env.staging.local if theyare present.

包.json

"buildStaging": "vue-cli-service build --mode staging",

.env.staging

VUE_APP_LOG_PRODUCTION_TIP=true

然后

>npm run buildStaging
> between-us-drivers@0.1.0 buildStaging C:\dev\mezinamiridici\spa
> vue-cli-service build --mode staging
/ Building for staging...

结果是:

171 650 admin-chunk.js
112 650 admin-chunk.js.map
6 156 774 app.js
6 008 903 app.js.map
1 517 776 content-chunk.js
1 434 561 content-chunk.js.map
477 276 user-chunk.js
425 751 user-chunk.js.map

为什么有开发构建而不是生产构建?

最佳答案

如果您希望您的暂存生成生产版本,您需要通过 .env.staging 中的 NODE_ENV 指定它:

NODE_ENV=production
VUE_APP_LOG_PRODUCTION_TIP=true

这在 the documentation example for staging 中有所暗示,但未突出显示:

The app is built as a production app because of the NODE_ENV, but in the staging version, process.env.VUE_APP_TITLE is overwritten with a different value

核心行为在 the documentation 中稍早介绍了:

When running vue-cli-service, [...] NODE_ENV will be set to "production" in production mode, "test" in test mode, and defaults to "development" otherwise.

关于javascript - Vue staging build 创建一个开发构建而不是生产,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64881963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com