diff options
author | 2022-08-29 14:06:36 -0400 | |
---|---|---|
committer | 2022-08-29 14:06:36 -0400 | |
commit | 1222ab9540d17e4e7e811240b8a2a039acc333cb (patch) | |
tree | cad17bb7b5a4fb58d80c70daafa5e575b12b3ef8 | |
parent | feb88afb8c784e0db65be96073a1b0064e36128c (diff) | |
download | astro-1222ab9540d17e4e7e811240b8a2a039acc333cb.tar.gz astro-1222ab9540d17e4e7e811240b8a2a039acc333cb.tar.zst astro-1222ab9540d17e4e7e811240b8a2a039acc333cb.zip |
Configures Lit to work with its decorators (#4503)
* Configures Lit to work with its decorators
* Remove comment
-rw-r--r-- | .changeset/beige-students-chew.md | 5 | ||||
-rw-r--r-- | packages/astro/test/fixtures/lit-element/src/components/my-element.ts (renamed from packages/astro/test/fixtures/lit-element/src/components/my-element.js) | 8 | ||||
-rw-r--r-- | packages/astro/test/fixtures/lit-element/tsconfig.json | 3 | ||||
-rw-r--r-- | packages/integrations/lit/src/index.ts | 2 |
4 files changed, 14 insertions, 4 deletions
diff --git a/.changeset/beige-students-chew.md b/.changeset/beige-students-chew.md new file mode 100644 index 000000000..25353dc1d --- /dev/null +++ b/.changeset/beige-students-chew.md @@ -0,0 +1,5 @@ +--- +'@astrojs/lit': patch +--- + +Allow using Lit's decorators diff --git a/packages/astro/test/fixtures/lit-element/src/components/my-element.js b/packages/astro/test/fixtures/lit-element/src/components/my-element.ts index e946924cf..c4c1b92b4 100644 --- a/packages/astro/test/fixtures/lit-element/src/components/my-element.js +++ b/packages/astro/test/fixtures/lit-element/src/components/my-element.ts @@ -1,8 +1,12 @@ import { LitElement, html } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; +@customElement('my-element') export class MyElement extends LitElement { + @property({ type: Boolean }) + bool = 0; + static properties = { - bool: {type: Boolean}, str: {type: String, attribute: 'str-attr'}, obj: {type: Object}, reflectedBool: {type: Boolean, reflect: true}, @@ -36,5 +40,3 @@ export class MyElement extends LitElement { `; } } - -customElements.define('my-element', MyElement); diff --git a/packages/astro/test/fixtures/lit-element/tsconfig.json b/packages/astro/test/fixtures/lit-element/tsconfig.json new file mode 100644 index 000000000..f79d7bdca --- /dev/null +++ b/packages/astro/test/fixtures/lit-element/tsconfig.json @@ -0,0 +1,3 @@ +{ + "experimentalDecorators": true +} diff --git a/packages/integrations/lit/src/index.ts b/packages/integrations/lit/src/index.ts index fa96a4687..5b428ef8d 100644 --- a/packages/integrations/lit/src/index.ts +++ b/packages/integrations/lit/src/index.ts @@ -13,7 +13,7 @@ function getViteConfiguration() { exclude: ['@astrojs/lit/server.js'], }, ssr: { - external: ['lit-element', '@lit-labs/ssr', '@astrojs/lit'], + external: ['lit-element', '@lit-labs/ssr', '@astrojs/lit', 'lit/decorators.js'], }, }; } |