Reputation: 5430
While working on a number of Aurelia applications we reached the point that we need to share code between these applications.
The code to be shared is not something we (actually our customer) would like to be open sourced. So we were thinking of creating private jspm packages so we can easily reuse our modules when needed. This idea is inspired on this blogpost
Jspm does support linking packages as well so that is something we would really like to use during development, as the code to be reused is not yet stable enough.
So our intended workflow is to create different number of projects/modules with ES2016
code and create jspm packages from these projects. These packages will then be installed and linked in our applications.
As far as we know jspm packages need to be transpiled before you install it into your project. So we always need to transpile code if there is any change.
According to this systemjs/babel-plugin documentation there will be support for on the fly transpiling in version 0.17
(which is in beta at this point). Currently we're using jspm
version 0.16.32
which does not support on the fly transpiling with babel 6
.
Somehow this workflow feels over-engineered, so we consider on the fly transpiling in our applications, though we fear a performance penalty.
How would you approach sharing es2016
code between different Aurelia applications?
Is there anyway to achieve code reuse without using jspm packages?
Upvotes: 4
Views: 161
Reputation: 10887
I personally would publish the packages to an internal npm feed of some sort. Set up the internal feed to mirror the public npm feed, then set your .npmrc to point to the private feed. Then just
jspm install npm:my-private-package
Upvotes: 1