I am setting up a new project using lit-element from polymer and the build setup includes the use of parcel. I am also using typescript to write my code.
I started by initializing npm and added all the necessary dependencies:
"dependencies": {
"@polymer/lit-element": "^0.6.5",
"@webcomponents/webcomponentsjs": "^2.2.1"
},
"devDependencies": {
"parcel-bundler": "^1.11.0",
"tslib": "^1.9.3",
"typescript": "^3.2.2"
}
Now when I run the parcel to start with index.html which includes:
@webcomponents/webcomponentsjs/webcomponents-bundle.js
I get an error saying:
Class constructor LitElement cannot be invoked without 'new'
Based on others suggestion I have tried setting tsconfig target to "es2016" but this does not solve the error.
my-element.ts
import {
LitElement,
html,
customElement,
property
} from '@polymer/lit-element'
@customElement('ui-text')
export class UiText extends LitElement {
render() {
return html`<p>Hi</p>`
}
}