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

feat: add webpack4 support #495

Merged
merged 46 commits into from
Apr 27, 2018
Merged

feat: add webpack4 support #495

merged 46 commits into from
Apr 27, 2018

Conversation

SvetoslavTsenov
Copy link
Contributor

Support for webpack 4 and angular@6

sis0k0 added 30 commits March 13, 2018 17:41
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
When building for Android the App_Resources for iOS should be copied to the dist directory and vice-versa.
- Remove tns-java-classes generation.
- Concatenate multiple chunks in order to generate snapshot.
@manoldonev manoldonev changed the title Sis0k0/webpack4 feat: add webpack4 support Apr 17, 2018
@manoldonev
Copy link
Contributor

test

Disabling pathinfo results in faster builds/rebuilds (~2s).
@SvetoslavTsenov
Copy link
Contributor Author

test

@SvetoslavTsenov
Copy link
Contributor Author

So far the job that is triggered on windows is failing with error

`Entrypoint bundle = vendor.js bundle.js
Entrypoint vendor = common.js vendor.js
[./main.aot.ts] 0 bytes {bundle} [built]
[./vendor.ts] 0 bytes {common} [built]

ERROR in TypeError: Cannot read property 'map' of undefined
at AotCompiler.loadFilesAsync (C:\Jenkins\execroot\angular\packages\compiler\src\aot\compiler.ts:202:41)
at C:\Jenkins\workspace\PR-webpack-angular-app-android-win\nativescript-dev-webpack\demo\AngularApp\packages\compiler-cli\src\transformers\program.ts:183:32
at
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Webpack compilation complete.
Executing webpack failed with exit code 2.`

@sis0k0
Copy link
Contributor

sis0k0 commented Apr 17, 2018

@SvetoslavTsenov , can you share the package.json and the webpack config? The ngtools/webpack plugin may not be updated.

@manoldonev
Copy link
Contributor

@sis0k0 demo apps' dependencies are now updated.

@manoldonev
Copy link
Contributor

test

@sis0k0
Copy link
Contributor

sis0k0 commented Apr 25, 2018

test

Copy link
Contributor

@sis0k0 sis0k0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need some follow-up PRs to finish this.

@sis0k0
Copy link
Contributor

sis0k0 commented Apr 25, 2018

test

@SvetoslavTsenov
Copy link
Contributor Author

test nativescript_angular@rc

@sis0k0 sis0k0 merged commit eefce39 into master Apr 27, 2018
@vchimev vchimev deleted the sis0k0/webpack4 branch May 1, 2018 07:31
@vchimev vchimev mentioned this pull request May 1, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants