TheUnreal
TheUnreal

Reputation: 24492

Best way to publish angular 2 app for web host

Assuming I'm not using the angular-cli, What would be the best way create the dist folder with all the required files for uploading to a web host in order to publish my app?

My project is based on the angular 2 quickstart, Structed like this on localhost:

enter image description here

Upvotes: 0

Views: 2942

Answers (1)

Daniel Pliscki
Daniel Pliscki

Reputation: 1933

TL;DR; Read this article on how to create a consist building process while angular-cli doesn't reach a stable version.

It all comes to the module loader used in your project. From what I've seen in the community the most used are SystemJS(the same as yours) and webpack. In either cases you'll need a build process to create a distribution package of your application.

Things to know.

SystemJS: It's simpler to configure but require external tools for building processes.

Webpack: Harder to configure, but It can do almost everything from module loading to app distribution.

For both tools you have the following options

Use a seed project.

Pros: It will have a lot of features ready and easy to use out of the box. For instance, in a good seed project you'll be able to build your app with a simple npm command.

Cons: Sometimes the seed project does much more than what you need; Errors might be harder to track.

For example, for webpack there's the angular2-webpack-start.

Configure everything from scratch

Pros: You'll have a full understanding of everything happening in your app; Errors are easier to track.

Cons: Requires additional research on which tools you'll need to use; Setting everything up can be hard.

Additionally to those options, there's the angular-cli project, which is pretty much a working in progress, but has been highly endorced by angular team.

Conclusion

I wouldn't use a seed project since I want to know what is happening in my app, however I believe that angular-cli is solid project and once it gets to a stable version I will adopt it.

In the mean time, I'm configuring everything from scratch and following this amazing article from Mink Gechev on how to optimize building process.

Upvotes: 2

Related Questions