Skip to content

Ability to detect within webpack if app is being built for release #4497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cowboyd opened this issue Apr 2, 2019 · 2 comments
Closed

Ability to detect within webpack if app is being built for release #4497

cowboyd opened this issue Apr 2, 2019 · 2 comments

Comments

@cowboyd
Copy link

cowboyd commented Apr 2, 2019

Is your feature request related to a problem? Please describe.

We have a set of flags that we're passing to webpack in order to make decisions about the build... Thinks like --env.gateway and --env.bluetooth which we'd like to have different defaults depending on whether this is a debug build or a release build.

We haven't been able to find a documented way of determining at build time if we're building with --release

Describe the solution you'd like

A way to know within our webpack environment if we're building for release, or debug. That way, we can have a different set of defaults for our flags.

I would simulate this by passing an --env.profile=release, e.g.

$ tns build ios --release --env.profile=release

It would be nice to see if we couldn't keep these two in sync.

Describe alternatives you've considered

See above for alternatives ( a manually maintained --env.profile flag.
Additional context

@DimitarTachev DimitarTachev added this to the 6.0.0 milestone Apr 3, 2019
@DimitarTachev
Copy link
Contributor

Hi @cowboyd,

We've already discussed this internally and most probably we will add it for our 6.0.0 release.

We have the same requirements in our Webpack configs (e.g. take a look here), and the checks are currently based on the --env.uglify flag as most often the release builds are used along with uglify.

I suggest you track this issue and base your checks on the uglify flag (don't forget to pass it to your release build) till we implement a better solution.

@rosen-vladimirov
Copy link
Contributor

With NativeScript 6.0.0 you can check the env.production value - CLI will set it to true when --release is passed.

NOTE: This version will be set as well when user passes --env.production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants