Aurelia: Webpack, JSPM or CLI?
Asked Answered
A

4

22

I've been developing in Aurelia-CLI for about 3 months and like it so far. I think it's a solid framework and obviously escalating in support and usage. That's a good thing!

Before I develop much more of my large app, I'm wondering if I'm using the best build system. I've only tried Aurelia-CLI and am not really familiar with Webpack or JSPM, and therefore I don't know what I'm missing. Are there any clear advantages or disadvantages in using either of the other two build systems, or is using the CLI the most clean and supported approach? Since I'm developing independently, I don't have any external constraints.

Thanks for your help.

Argentite answered 3/1, 2017 at 21:59 Comment(0)
K
39

UPDATE

This answer is almost two years old. Feel free to research updates and provide another more complete answer and I can replace this answer or point to that answer. Thanks!

Aurelia CLI

Aurelia CLI is great for getting started. It's important to understand that under the covers the CLI is using require.js but proxies the configuration through aurelia.json in your application. This means that you need to understand how to configure aurelia to work with require.js at the moment. Once you need to start configuring to match your workflow or change build steps up it gets a bit cumbersome at the moment. We are working to improve this. There are many features planned for the Aurelia CLI but given at the time of writing this that it is in an alpha / beta state it should generally be used on proof of concept or other smaller apps, not production-ready large scale apps yet.

WebPack

WebPack is arguably the most popular kid on the block at the moment. WebPack is not a module loader, but a bundler. It's important to understand this because while we strive to make Aurelia work great with all module loaders WebPack by default is not in charge of loading modules so a dynamically loaded application requires the developer to expand on this. WebPack is strong in creating optimized bundles and can be easy to use as long as you are comfortable with configure WebPack. WebPack has considerably more GitHub stars due to the popularity from React using WebPack it's hard to say whether the choice is better when using Aurelia simply because of the number of GitHub stars.

JSPM / System.js

Some of the skeletons use JSPM and System.js. The reason is that these are the closest to 'spec compliant' solutions. JSPM tries to help as much as possible when loading from the JSPM registry. If not yet available in the registry you can load from NPM or GitHub directly. From a module loading perspective you use a config.js file that is (usually) automatically maintained when installing dependencies to improve the developer workflow.

Side biased note

On most larger apps at the moment I typically prefer using JSPM / System.js simply because I have a great understanding of the tooling and prefer the control that I am provided. I work on a great number of Aurelia apps that are in production and typically reserve CLI for smaller proof of concept apps and WebPack is a great alternative but I prefer the flexibility and understanding I have with JSPM / System.js at the moment.

Kolomna answered 4/1, 2017 at 5:48 Comment(2)
This answer should be getting more upvotes than mine!Osmious
@pw-kad Is your answer still relevant? I have the impression that JSPM has been superseded by the changed module loader specs, and it looks like WebPack is the new preferred way forward (looking at the aurelia news). We are using jspm/systemjs ourselves and feel a bit stuck (using custom build steps in gulp)/ left-out on the jspm/systemjs stack.Amin
O
9

The CLI isn't currently feature complete, but it is a much simpler setup. Webpack can basically do anything you want to do, but you'll be maintaining your webpack configuration just as much as you maintain your Aurelia code.

Ok, maybe not just as much, but you'll have to learn Webpack to use webpack. The Aurelia CLI is simple to get started, but has some definite limitations. For example, CSS files that reference external resources won't work w/the Aurelia CLI, but they should work fine with Webpack.

Osmious answered 3/1, 2017 at 22:37 Comment(2)
Could you elaborate or give an example of an external resource which won't play nice with the aurelia cli?Antiar
For example, a CSS file that references an image fileOsmious
F
4

First, I can understand if this post gets shutdown due to its subjective nature.

I believe it's time to re-visit the answers about Aurelia CLI being a second-class tool. I respect both PW Kad and Ashley Grant immensely, but I am just not convinced that a statement like this is true anymore:

There are many features planned for the Aurelia CLI but given at the time of writing this that it is in an alpha / beta state it should generally be used on proof of concept or other smaller apps, not production-ready large scale apps yet.

Notably, I have a production application that way back in the day I started with Aurelia CLI, and changed it to JSPM precisely for the reasons noted. But recently, I rebuilt the same app from scratch using the CLI and I realize that it is much easier to use, particularly managing modules and publishing! And this is an app with Google Maps, Google Analytics, Auth0, DevExpress, Bootstrap, etc.

Just think it is time to give Aurelia CLI a little love. It's ready.

Frederickfredericka answered 26/1, 2018 at 14:9 Comment(0)
Q
2

Aurelia CLI is the most preferred option with this announcement.

http://aurelia.io/blog/2017/08/18/aurelia-cli-webpack-update/

Now It has more flexibility for your choice of preferences.

Quandary answered 8/2, 2018 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.