Skip to content

Commit 1222ab9

Browse files
authored
Configures Lit to work with its decorators (#4503)
* Configures Lit to work with its decorators * Remove comment
1 parent feb88af commit 1222ab9

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

.changeset/beige-students-chew.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/lit': patch
3+
---
4+
5+
Allow using Lit's decorators

packages/astro/test/fixtures/lit-element/src/components/my-element.js renamed to packages/astro/test/fixtures/lit-element/src/components/my-element.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { LitElement, html } from 'lit';
2+
import { customElement, property } from 'lit/decorators.js';
23

4+
@customElement('my-element')
35
export class MyElement extends LitElement {
6+
@property({ type: Boolean })
7+
bool = 0;
8+
49
static properties = {
5-
bool: {type: Boolean},
610
str: {type: String, attribute: 'str-attr'},
711
obj: {type: Object},
812
reflectedBool: {type: Boolean, reflect: true},
@@ -36,5 +40,3 @@ export class MyElement extends LitElement {
3640
`;
3741
}
3842
}
39-
40-
customElements.define('my-element', MyElement);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"experimentalDecorators": true
3+
}

packages/integrations/lit/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function getViteConfiguration() {
1313
exclude: ['@astrojs/lit/server.js'],
1414
},
1515
ssr: {
16-
external: ['lit-element', '@lit-labs/ssr', '@astrojs/lit'],
16+
external: ['lit-element', '@lit-labs/ssr', '@astrojs/lit', 'lit/decorators.js'],
1717
},
1818
};
1919
}

0 commit comments

Comments
 (0)