Library module in Aurelia?

Hello!

I am transitioning from Angular (2+) to Aurelia. So far i really like it!
However, i am wondering if there is an equivalent to Angular´s Modules.

What i want to achieve,
is a core module containing common services that every app needs in multiple places - e.g. auth - and multiple feature modules, without duplicating shared dependencies.
I never dug deep into Webpack, could it be so simple as splitting my app in ES6 modules or should i learn about Aurelia plugins? Are there any good resources for plugin development?
Thanks you very much.

Best,
Oliver

5 Likes

It all depends on your use case. I would suggest to start with creating normal node modules, and include the modules as “dependencies” in your app project. You can then use those packages by importing those normally.

Only if you need to do some bootstrapping activity while loading the app/node modules (for example, registering global resources), then you can create a ‘main’ file with a configure function in your node module, and use it in your app as .use.plugin('my-awesome-module').

For details, you can look here.

4 Likes

I don’t have anything helpful to add, just wanted to say welcome to the community!

I’ve been using Aurelia for almost two years now and I still love it and the team behind it. It makes me sad when I have to work with anything else.

Once again, “Welcome!”

4 Likes

I think that in Aurelia features are what most closely map to Angular modules.
Organizing Your App with Features

2 Likes

Welcome to the community, you wouldn’t find anything special about aurelia except that it is mostly pure javascript/typescript and goes all the standard path, maybe its the special thing about aurelia.

This might also be helpful beside what other guys suggested above. I hope you enjoy Aurelia.

2 Likes

Hello,

@ lancelot316 Yes, features seem to be what i was looking for. Lazy-loading and Tree-shaking would be next. It seems like Features could be lazy-loaded when combining them with this approach.

Thank you all for the warm welcome!

2 Likes