lit / lit.dev

The Lit website
https://lit.dev
BSD 3-Clause "New" or "Revised" License
117 stars 173 forks source link

How to import customElement, property from bundle #1342

Open ryanwhite04 opened 3 months ago

ryanwhite04 commented 3 months ago

In the docs i'm told to use:

import {LitElement, html} from 'lit'; import {customElement, property} from 'lit/decorators.js';

but if i'm using bundle, only

import {LitElement, html} from 'https://cdn.jsdelivr.net/gh/lit/dist@3/core/lit-core.min.js';

is given.

how do i import customElement and property from jsdelivr.

I can see there is a file "lit-all" at https://cdn.jsdelivr.net/gh/lit/dist@3.1.4/all/ but it doesn't seem to export customElement or property, and neither does lit-core, i get the error

Module '"https://cdn.jsdelivr.net/gh/lit/dist@3.1.4/all/lit-all.min.js"' has no exported member 'property'

Is the decorator module hosted elsewhere?

ryanwhite04 commented 3 months ago

I'm using the documentation at https://lit.dev/docs/getting-started/#use-bundles

justinfagnani commented 3 months ago

Decorators require a compiler, which is typically in a local, npm-using setup, so the bundles don't include the decorators.