I’ve developed a custom WebComponent using Angular Elements and am able to generate a single JS build file. The WebComponent is working perfectly fine when I add it into a single index.html file as
http://./web-component-file-name.js, including it’s tag name in the same index.html file and spinning a local HTTP server using ‘http-server’.
I then created a new basic Angular app, and tried to add this component. Followed the article till this point from beginning – added the below snippet also installing the required dependency
When I try ng serve, it’s working perfectly as expected. The issue occurs when I’m trying to build the project to get compiled files using
ng build --prod. The build completes successfully without any errors and when I’m trying to host the files using http-server, I don’t see anything (not even the boilerplate Angular code). Neither do I see any error in console. What is it that I’m missing here?
P.S. I’m developing this component so that it could be used across different frameworks used within my organization, hence went with WebComponents.
Source: Angular Questions