Reputation: 315
I'm creating desktop and web apps as pure HTML+JavaScript and recently started using Web Components, as discussed here: How to run web components based HTML without node?
And here: How to run Polymer locally, without any web server?
I would like to do the same with LWC components and be able to include them in basic HTML/JS apps, without using node. I guess that potentially this can be done by replacing "import { LightningElement } from 'lwc'" with some external JavaScript files?
Any simple example would be appreciated - thanks!
Upvotes: 0
Views: 805
Reputation: 315
I received a response from LWC development team, as follows:
" LWC components must be compiled by the LWC compiler before they can be run, so no, you cannot directly import LWC source files in the browser and use them in the browser. However, you can use the CustomElementConstructor API to import a compiled LWC component just like any other web component. Here is a demo: https://github.com/nolanlawson/lwc-barebone/tree/7e3662b7a86aa1f1ca2e0b39c2696057d3495519/src
Upvotes: 1