离子构建:--prod 和--release 标志之间的区别? [英] Ionic build: difference between --prod and --release flags?

查看:23
本文介绍了离子构建:--prod 和--release 标志之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行 ionic build 时,我很好奇 --prod--release 标志之间的区别?

Ionic 构建文档 状态:

<块引用>

--prod 构建用于生产的应用程序
--release 创建 Cordova 发布版本

Cordova CLI ref 没有提到 --prod 标志,它声明了 --release 的以下内容:

<块引用>

执行发布版本.这通常转化为发布模式正在构建的底层平台.

查看构建输出的差异,使用 --prod 构建似乎运行 Ionic '生产' 构建,因为它还运行 ngcuglify(它本身运行 cleancss)任务.

当我使用 --release 运行构建时,我似乎得到了 Cordova 发布构建,它(根据文档)尝试在其上运行发布构建无论您的目标是什么平台.

这些是唯一的区别,还是我过于简单化了?

作为参考,请注意以下输出 APK 文件大小:

  • 产品标志:9.8 MB
  • 发布标志:11.7 MB
  • 产品 + 发布标志:8.9 MB

我使用的是最新 (ATTOW) 版本的 Ionic Framework (3.9.2) 和 CLI (3.20.0).

解决方案

Prod 优化代码,Release 让它以不同的方式构建,所以该应用程序可以发布到商店.您必须同时使用两者才能快速可以发布的版本.

正如 Sujan12 在此链接上所说.

When running an ionic build I'm curious as to the difference between the --prod and --release flags?

The Ionic build docs state:

--prod Build the application for production
--release Create a Cordova release build

and while the Cordova CLI ref doesn't mention a --prod flag, it states the following for --release:

Perform a release build. This typically translates to release mode for the underlying platform being built.

Looking at the difference in the build output, building with --prod seems to run an Ionic 'production' build, in that it also runs the ngc and uglify (which itself runs cleancss) tasks.

And when I run a build with --release, I seem to get a Cordova release build, which (per the docs) attempts to run a release build on whatever platform you're targeting.

Are those the only differences, or am I over-simplifying?

For reference, note the following output APK filesizes:

  • Prod flag: 9.8 MB
  • Release flag: 11.7 MB
  • Prod + Release flags: 8.9 MB

I'm using the latest (ATTOW) version of the Ionic Framework (3.9.2) and CLI (3.20.0).

解决方案

Prod optimizes the code, Release makes it build in a different way so the app can be released to the stores. You have to use both for a fast version that can be released.

As Sujan12 says on this link.

这篇关于离子构建:--prod 和--release 标志之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆