Open WUSO01 opened 3 years ago
Fixes #1121
I Write lit-element like this:
@customElement('custom-div') export class CustomDiv extends LitElement { @query('#btn') btn: HTMLButtonElement // .... }
And I also used babel(v7) and webpack(v4), I set @babel/plugin-proposal-decorators legacy was true
babel(v7)
webpack(v4)
@babel/plugin-proposal-decorators
babel.config.json:
{ "presets": [ "@babel/env", "@babel/preset-typescript" ], "plugins": [ [ "@babel/plugin-proposal-decorators", { "legacy": true } ], [ "@babel/plugin-proposal-class-properties" ] ] }
When I builded i got an error: this.btn is undefined. If you change legacy todecoratorsBeforeExport, this issue won't be show.
this.btn is undefined
legacy
decoratorsBeforeExport
I founded the issue cased by legacyQuery function didn't use 'return' Statement.
Legacy mode will cause other problems, eg: updated lifecycle changedProperties always empty Map
updated
Fixes #1121
I Write lit-element like this:
And I also used
babel(v7)
andwebpack(v4)
, I set@babel/plugin-proposal-decorators
legacy was truebabel.config.json:
When I builded i got an error:
this.btn is undefined
. If you changelegacy
todecoratorsBeforeExport
, this issue won't be show.I founded the issue cased by legacyQuery function didn't use 'return' Statement.