Book Image

NativeScript for Angular Mobile Development

By : Nathan Walker, Nathanael J. Anderson
Book Image

NativeScript for Angular Mobile Development

By: Nathan Walker, Nathanael J. Anderson

Overview of this book

NativeScript is an open source framework that is built by Progress in order to build truly native mobile apps with TypeScript, JavaScript or just Angular which is an open source framework built by Google that offers declarative templates, dependency injection, and fully featured modules to build rich applications. Angular’s versatile view handling architecture allows your views to be rendered as highly performant UI components native to iOS and Android mobile platforms. This decoupling of the view rendering layer in Angular combined with the power of native APIs with NativeScript have together created the powerful and exciting technology stack of NativeScript for Angular. This book focuses on the key concepts that you will need to know to build a NativeScript for Angular mobile app for iOS and Android. We’ll build a fun multitrack recording studio app, touching on powerful key concepts from both technologies that you may need to know when you start building an app of your own. The structure of the book takes the reader from a void to a deployed app on both the App Store and Google Play, serving as a reference guide and valuable tips/tricks handbook. By the end of this book, you’ll know majority of key concepts needed to build a successful NativeScript for Angular app.
Table of Contents (24 chapters)
Title Page
About the Authors
About the Reviewer
Customer Feedback
Integration Testing with Appium

Using webpack to bundle the app

If it weren't for Sean Larkin, you might have never heard of webpack. His contributions and involvement in the bundler community have helped bring webpack into the Angular CLI and also make it a primary go-to bundler for many things. We greatly appreciate his efforts and kindness in the community.

Preparing to use webpack

Let's take a look at how webpack can be utilized to reduce the packaged size of our NativeScript for Angular app in addition to ensuring that it executes optimally on a user's mobile device.

Let's first install the plugin:

npm install nativescript-dev-webpack --save-dev

This automatically creates a webpack.config.js file (at root of project) preconfigured with a basic setup that will get you reasonably further with most apps. Additionally, it creates a tsconfig.aot.json file (also at root of project) since NativeScript's webpack usage will use Angular's AoT compiler while bundling. It also adds some nifty npm scripts to our package.json to help...