I have an angular multi project solution where I have libraries with components. I would like to publish these libraries to NPM but as web components with Angular Elements.
It seems possible to define these as elements in an Angular Application but not in an Angular Library. All guides and tutorials I have found on the internet always make one application in order to define the custom element.
The problem as I see it is that I cannot publish the Angular application that defined the custom elements on npm and similar and when I try to define the elements in the module of the library (or as standalone components) it seems like it's not actually a self contained web component but requires angular.
When I try to import the built component in a normal javascript file
import { ButtonComponent } from './my-lib/fesm2020/my-lib.mjs'
I get this following error:
Uncaught TypeError: Failed to resolve module specifier "@angular/core". Relative references must start with either "/", "./", or "../".
Is it even possible to build angular components as custom elements without the requirement of angular for the third party user and is it possible to do it without having an angular application and only using an angular library?
Thanks in advance for your sage advice and better wisdom!