nciao
nciao

Reputation: 601

Can I use Angular2 to build a JavaScript Universal Windows Platform App?

JavaScript newbie here. I'm new to Angular2 and am currently learning about things like module-loaders (there's so many!), etc, so bear with me since my space of "unknown unknowns" is probably quite large.

I'm interested in creating a JavaScript based "Packaged Web App" for windows ("Packaged" in the sense that the JS is included in the Universal Windows Platform app).

One constraint to keep in mind is that I have severe limitations on the size of my packaged app. The smaller, the better.

With that in mind, I have a few specific questions that will hopefully expose the extent of my ignorance:


  1. Without resorting to Electron or Ionic2, is it possible (also, is it a good idea) to create the offline experience in Angular2 and then only manually include the resulting transpiled .js files in my Visual Studio project?
  2. How hard is it to manage the dependencies for these transpiled files? Are they entirely self contained?
  3. Roughly how large would the minimum set of manually imported files end up being? When I use NPM to install angular2, it winds up being ~80mb - a large portion of this (most?) looks like dev tools, test infrastructure, etc. What's the minimal set of angular dependencies needed for the client app to work?

Thanks!

Upvotes: 1

Views: 601

Answers (2)

nciao
nciao

Reputation: 601

Answering my own question here:

  1. Yes, it's possible. You can copy over the transpiled .js files and then simply point the webview control at the generated index.html. With that being said, it's a pretty kludgy dev experience since you're constantly working around VS.
  2. The dependencies are handled for you - it's all in the minified/uglified js files.
  3. I haven't investigated tree-shaking yet, but it looks like I can get away with ~0.5Mb with a skeleton project.

Upvotes: 0

Elvis Xia - MSFT
Elvis Xia - MSFT

Reputation: 10831

Without resorting to Electron or Ionic2, is it possible (also, is it a good idea) to create the offline experience in Angular2 and then only manually include the resulting transpiled .js files in my Visual Studio project?

Yes, it is possible. TypeScript will be compiled to javascript codes, which will be consumed by your project. So eventually, it is compiled js codes that will be necessary for your project.

But, if you are so worried about your project's size, then I suggest you using Angular 1, which is only JS codes. And for the minimum size of Angular 1 and its dependency jquery. There is a compressed version of Angular 1 (angular.min.js: 164kb) and jquery(jquery-3.1.1.min.js: 85kb).

Upvotes: 1

Related Questions