Lit 3 Standard Decorators not allowed on field

204 Views Asked by At

The error thrown: Uncaught Error: Unsupported decorator location: field

Example class using the Lit @queryDecorator for a field to query from the components shadow-dom.

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

class MyElement extends LitElement {
  @query('iframe,video') accessor player;
}

I have tried with/without the accessor. Setting the player =null for some sort of initialization.

Babel is used in the project with what should be the proper plugin with specified version for standard decorator support. Using Babel Preset-Env as well.

['@babel/plugin-proposal-decorators', {version: '2023-05'}]

Maybe I have missed something in the Lit 3 documentation around this? Maybe something in the project build process isn't compatible while using rollup.

0

There are 0 best solutions below