Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 1476e57

Browse files
committed
fix: clean android build artifacts when using with uglify
1 parent dbde299 commit 1476e57

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: bin/ns-bundle

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if (!process.env.npm_config_argv) {
1414

1515
const escape = arg => `"${arg}"`;
1616
const isTnsCommand = flag => flag.endsWith("-app");
17+
const shouldUglify = () => process.env.npm_config_uglify;
1718

1819
const npmArgs = JSON.parse(process.env.npm_config_argv).original;
1920
const tnsArgs = getTnsArgs(npmArgs).map(escape);
@@ -67,9 +68,9 @@ function cleanBuildArtifacts(platform) {
6768
getTnsVersion().then(versionString => {
6869
const version = versionToNumber(versionString);
6970

70-
// for nativescript-cli v3.0.1 and below
7171
// the android build artifacts should be cleaned manually
72-
if (version <= 301) {
72+
// for nativescript-cli v3.0.1 and below or if using uglify
73+
if (version <= 301 || shouldUglify()) {
7374
gradlewClean().then(resolve).catch(throwError);
7475
} else {
7576
return resolve();
@@ -133,7 +134,7 @@ function webpack(platform) {
133134
`--config=webpack.config.js`,
134135
`--progress`,
135136
`--env.${platform}`,
136-
process.env.npm_config_uglify && `--env.uglify`,
137+
shouldUglify() && `--env.uglify`,
137138
];
138139

139140
spawnChildProcess(...args)

0 commit comments

Comments
 (0)