How to Compile Angular Element Into Web Component w/ Webpack or Angular CLI?

后端 未结 4 1481
傲寒
傲寒 2021-02-13 04:06

I built a simple Web Component via Angular using Pascal Precht\'s tutorial, which you can see working HERE. It auto-magically compiles in the on Stackblitz in the link, but not

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-13 04:36

    Hello there.

    If i am understanding correctly, you want to generate a Web Component (lets say ) and then with a simple script tag to get the .js file to initialize that component and add it on any html page you want to.

    In my GitHub repository i have created a simple Todo List Component. That component follows the Angular Elements Principles and also, i have installed some file managment libraries for webpack to also pack the JS into one JS file.

    You can check this repository out and see if that helps you out. Just clone it and then run npm install followed by npm run build:elements Feel free to contact me if anything goes south.

    Also check this guide. This guy has helped me a lot.

    Best of luck

提交回复
热议问题