-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin in separate repository #45
Comments
Hi @restjohn yes you can, in fact that is the point behind a plugin architecture. Plugin code shall be separated from the main app and reused whenever possible. The plugin itself is an Angular library that could be kept and maintained in a separate repository. Builder is building it as an application to benefit the build process of an Angular application optimization and bundling. Since plugin is just an Angular library it could be published to NPM and installed in a different plugin as a dependency. Building the consumer plugin you could drop the dependency by adding it as an external. You would benefit the version control of NPM package. Good luck! |
Hello and thanks for the reply. I've made an attempt to demonstrate the scenario I want to achieve: https://github.com/restjohn/ngx-plugins. If ever you have some spare moments I'd love to know your thoughts. You'll see that the host app and shared library reside in the same workspace, while the plugin resides in a separate workspace and references the host shared library as an NPM dependency. I tried to simplify the implementation a bit by removing the custom plugin builder and using Angular's built-in ng-packagr library builder to create plugin libraries then load them from their UMD bundle. This still achieves the desired effect of omitting shared libraries from the plugin bundle, because ng-packagr does that by default. I still have some questions to address, such as the potential need to cache the plugin modules the Angular Thanks again for your time. |
Hello @restjohn I didn't have enough time to see the entire code but here are some notes:
Hope my explanation is of help to you. |
Thanks for taking the time to look and for your detailed response! |
Hello and thanks for your article and repo.
Is there a way to extend this architecture such that plugin code can exist in a different Angular library/repository, and build against the core app as an NPM dependency? Would this require that the core app be broken into separate projects, something like a library of injectable services and shared libraries that plugins can inject and use, as well as the main app entry point? The main app would then use the core library, just as the plugins would. A plugin's
package.json
file might then look something likeThen NPM would enforce version compatibility between the plugins and the core app.
The text was updated successfully, but these errors were encountered: