-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Export catalog components to be able to reuse them #1245
Comments
Hi, have you tried importing the components into your module's |
Hi, in general, Angular does not allow you to declare a component in more than one module. For example, if you want to use component "A" in multiple components (each declared in a different module), you must create a module for component "A". This "A" module can then be imported into the modules of the components in which you want to use it. The "A" module then only needs to export the "A" component via the I still tried to declare the component in my module. This gives me a lot of other errors that have nothing to do with declaring it in 2 modules. The errors come from the fact that I would have to declare all components that are used within the components themselves. In the end, I would have to create a separate catalog module that does the same as yours, and even that wouldn't stop the app bundle from increasing in size, because of the duplicate declarations of the components. It would be great if you could release a new npm package with a version of |
OK, thanks for the explanation. I'll add this to the next release. If you like you can test locally by cloning this repo, making the change and building the admin-ui package and using the built package files in your node_modules - either copy paste them or use something like Verdaccio to install from a local npm server. But I think it is a pretty straightforward change. |
Is your feature request related to a problem? Please describe.
We would like to reuse your components from the CatalogModule (for example, the ProductAssetsComponent) in our own plugins. Currently, we have to copy all the component code into new files to use it in our plugin. It would be nice if instead we could just import the CatalogModule into the plugin's module and then use your existing components.
Describe the solution you'd like
Add all components declared in the CatalogModule to the
exports
array.Describe alternatives you've considered
Currently, we copy the required components and import them into the plugin module. Of course, this leads to larger app bundles, which we would like to avoid.
The text was updated successfully, but these errors were encountered: