Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

refactor: Update article for WebPack bundling via CLI with --bundle flag #993

Merged
NickIliev merged 9 commits into master from niliev/webpack-article-update
Dec 21, 2017

Conversation

Copy link
Contributor

@NickIliev NickIliev commented Dec 6, 2017

Updating article for bundling with WebPack to comply with the --uglify flag that is introduced with the upcoming version of NativeScript 3.4.

Related to NativeScript/NativeScript#5129

Related to NativeScript/nativescript-dev-webpack#328

Copy link
Contributor

@tjvantoll tjvantoll left a comment

Choose a reason for hiding this comment

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

Looks good! I only had some minor things.

fyi this other documentation page is going to need some updates as well: https://docs.nativescript.org/best-practices/startup-times. Let me know if you want to tackle that as part of this.

```

>If there are multiple mobile provisioning profiles for the selected development team available on the machine, it is not guaranteed that Xcode will select the desired one and publishing using the command line will be successful. Therefore, in such cases we recommend manually configuring and uploading the project from Xcode.
More options for publishing an iOS application can be found in ["Publishing for iOS"](https://docs.nativescript.org/publishing/publishing-ios-apps) article.
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

in Publishing for iOS article.

in the Publishing for iOS article.

NickIliev reacted with thumbs up emoji

### Bundling Background Workers

When the applicaiton is implementing workers some additional steps are required to make the project WebPack compatible. Use `nativescript-worker-loader` plugin.
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

applicaiton

application

WebPack

This article should stick with either webpack, Webpack, or WebPack for consistency.

NickIliev reacted with thumbs up emoji
$ tns build android --bundle --env.uglify
```

or, if you are building for release on Android:
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

Here’s you would build for release with uglify on Android:

NickIliev reacted with thumbs up emoji
```

or, if you are building for release:
Building for release with uglify on iOS
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

And here’s you you would build for release with uglify on iOS:

NickIliev reacted with thumbs up emoji
Copy link
Contributor Author

@NickIliev NickIliev Dec 6, 2017

Choose a reason for hiding this comment

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

Thanks, @tjvantoll - pushed all changes + updated the "How to build apps that starts fast" article as well

* No iOS support. Heap snapshot is a V8 feature which is the engine used in the Android Runtime. Providing `--snapshot` flag on the iOS bundling commands will have no effect.
* No Windows support. Providing `--snapshot` flag on the Android bundling command will have no effect on Windows machine.
* No iOS support. Heap snapshot is a V8 feature which is the engine used in the Android Runtime. Providing `--env.snapshot` flag on the iOS bundling commands will have no effect.
* No Windows support. Providing `--env.snapshot` flag on the Android bundling command will not affect Windows machine.
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

You didn’t change this, but...

Windows machine.

Should be

Windows machines.

NickIliev reacted with thumbs up emoji
$ tns build ios --bundle --env.aot
```

The `--env.aot` flag can be used in combination with `--env.uglify` and `--env.snapshot` (Note that snapshots are available for Android only).
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

The --env.aot flag can be used in combination with --env.uglify and --env.snapshot. (Note that snapshots are available for Android only.)

I just moved around the periods.

NickIliev reacted with thumbs up emoji
Copy link
Contributor

@tjvantoll tjvantoll left a comment

Choose a reason for hiding this comment

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

Wow that was fast :)

I added one more very trivial comment. Looks good!

```

4) Run on Android with webpack, UglifyJS, and V8 heap snapshot builds enabled.
4) Run on Android with webpack, UglifyJS, Angular Ahead-of-Time, and V8 heap snapshot builds enabled.
Copy link
Contributor

@tjvantoll tjvantoll Dec 6, 2017

Choose a reason for hiding this comment

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

Angular Ahead-of-Time,

Angular Ahead-of-Time compilation (if using Angular),

Just because this article is for Angular and non-Angular users.

NickIliev reacted with thumbs up emoji
@NickIliev NickIliev changed the title (削除) Updated article for WebPack bundling via CLI with --bundle flag (削除ここまで) (追記) refactor: Update article for WebPack bundling via CLI with --bundle flag (追記ここまで) Dec 20, 2017
@vchimev vchimev force-pushed the niliev/webpack-article-update branch from 0fb5d89 to e5494ad Compare December 20, 2017 13:10
Copy link
Contributor

sis0k0 commented Dec 20, 2017

Change WebPack to Webpack or just webpack

NickIliev reacted with thumbs up emoji


```

### Bundling Background Workers
Copy link
Contributor

Choose a reason for hiding this comment

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

nativescript-dev-webpack does that by default. Should we mention it explicitly here?

NickIliev reacted with thumbs up emoji

>If there are multiple mobile provisioning profiles for the selected development team available on the machine, it is not guaranteed that Xcode will select the desired one and publishing using the command line will be successful. Therefore, in such cases, we recommend manually configuring and uploading the project from Xcode.
### Angular and Ahead-of-Time Compilation
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to note somewhere that AoT is not the default now. It can be enabled by:

tns run android --bundle --env.aot

NickIliev reacted with thumbs up emoji
Copy link
Contributor Author

@NickIliev NickIliev Dec 20, 2017

Choose a reason for hiding this comment

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

Done with the section below - Angular Ahead-of-Time Compilation Build (AOT)

* No Windows support. Providing `--env.snapshot` flag on the Android bundling command will not affect Windows machines.
* Only one WebPack bundle can be snapshotted. By default, this is the `vendor` bundle because in most of the cases it is the largest one.

### Angular Ahead-of-Time Compilation Build (AOT)
Copy link
Contributor

Choose a reason for hiding this comment

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

We have the same section above?


Here's an example [configuration](https://github.com/NickIliev/NativeScript-Cosmos-Databank/blob/master/app/bundle-config.ts).

For non-Angular apps, make sure to add `bundle-config.js|ts` file in the `app` folder with the following content:
Copy link
Contributor

@manoldonev manoldonev Dec 20, 2017

Choose a reason for hiding this comment

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

@NickIliev This section is a bit unclear to me -- at the beginning (line 69) it says you have to register your modules to work with webpack bundles:

global.registerModule("main-page", () => require("./main-page"));

But then (the new section) says register them like:

const context = require.context("~/", true, /(page|fragment)\.(xml|css|js|ts|scss|less|sass)$/);
global.registerWebpackModules(context);

As far as I can understand both approaches achieve the same purpose (the latter does not require you to list explicitly all modules) but it is not obvious from the text content that is so.

NickIliev reacted with thumbs up emoji
Copy link
Contributor Author

@NickIliev NickIliev Dec 20, 2017

Choose a reason for hiding this comment

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

@manoldonev absolutely right! - revising the article right away by removing the obsolete snippet.

manoldonev reacted with thumbs up emoji
@NickIliev NickIliev merged commit b18910c into master Dec 21, 2017
@NickIliev NickIliev deleted the niliev/webpack-article-update branch December 21, 2017 07:57
Copy link

lock bot commented Aug 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Reviewers

@etabakov etabakov Awaiting requested review from etabakov

@PanayotCankov PanayotCankov Awaiting requested review from PanayotCankov

@vchimev vchimev Awaiting requested review from vchimev

4 more reviewers

@manoldonev manoldonev manoldonev left review comments

@tjvantoll tjvantoll tjvantoll approved these changes

@sis0k0 sis0k0 sis0k0 approved these changes

@tsonevn tsonevn tsonevn approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /