Configures Lit to work with its decorators (#4503)
* Configures Lit to work with its decorators * Remove comment
This commit is contained in:
parent
feb88afb8c
commit
1222ab9540
4 changed files with 14 additions and 4 deletions
5
.changeset/beige-students-chew.md
Normal file
5
.changeset/beige-students-chew.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/lit': patch
|
||||
---
|
||||
|
||||
Allow using Lit's decorators
|
|
@ -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);
|
3
packages/astro/test/fixtures/lit-element/tsconfig.json
vendored
Normal file
3
packages/astro/test/fixtures/lit-element/tsconfig.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"experimentalDecorators": true
|
||||
}
|
|
@ -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'],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue