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

fix(prepare): clean platforms/.../app/ when running webpack #465

Merged
merged 1 commit into from
Mar 22, 2018

Conversation

sis0k0
Copy link
Contributor

@sis0k0 sis0k0 commented Mar 17, 2018

Every time we are running a new build with webpack the platforms/.../app/ dir should be deleted as there may be old assets
left.

Ex.
When the app bundled with snapshot enabled:

tns build android --bundle --env.snapshot

this produces some assets:

platforms/android/.../app/vendor.js
platforms/android/.../app/_embedded_script.js
// ...

Then, if the project is bundled without snapshot:

tns build android --bundle

the produced assets will override the ones that are already in
platforms/android/.../app. However, since the build is without
snapshot, an _embedded_script.js won't be generated to override the one
that's left in platforms/android/.../app from the previous build.

We'll be using CleanWebpackPlugin to clean the dist folder.

Important: Currently we're running two webpack builds when doing
tns run android|ios - one on prepare and one when the watcher starts.
This means that the dist folder will be cleaned two times. This will be
resolved when
NativeScript/nativescript-cli#3404 is
implemented.

rebased on top of #459
fixes #463

@sis0k0
Copy link
Contributor Author

sis0k0 commented Mar 19, 2018

test

@sis0k0 sis0k0 force-pushed the sis0k0/clean-app-plugin branch from 93fb1a3 to 55e7981 Compare March 21, 2018 14:38
Every time we are running a new build with webpack the platforms/.../app/ dir should be deleted as there may be old assets
left.

Ex.
When the app bundled with snapshot enabled:
```
tns build android --bundle --env.snapshot
```
this produces some assets:
```
platforms/android/.../app/vendor.js
platforms/android/.../app/_embedded_script.js
// ...
```

Then, if the project is bundled without snapshot:
```
tns build android --bundle
```
the produced assets will override the ones that are already in
`platforms/android/.../app`. However, since the build is without
snapshot, an `_embedded_script.js` won't be generated to override the one
that's left in `platforms/android/.../app` from the previous build.

We'll be using `CleanWebpackPlugin` to clean the dist folder.
** Important **: Currently we're running two webpack builds when doing
`tns run android|ios` - one on prepare and one when the watcher starts.
This means that the dist folder will be cleaned two times. This will be
resolved when
NativeScript/nativescript-cli#3404 is
implemented.

fixes #463
@sis0k0 sis0k0 force-pushed the sis0k0/clean-app-plugin branch from 55e7981 to 940a90f Compare March 21, 2018 15:54
@sis0k0 sis0k0 requested a review from MartoYankov March 21, 2018 15:55
@sis0k0 sis0k0 merged commit cb2f51b into master Mar 22, 2018
@sis0k0 sis0k0 deleted the sis0k0/clean-app-plugin branch March 22, 2018 09:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

when you bundle with snapshot and then bundle without it, you will see exception in release
2 participants