Closed Artur- closed 3 years ago
The purpose of this change is so that vanilla users aren't taxed with extra decorators code in their bundles
fix:
import { html } from 'lit-element';
import { customElement, property, query } from 'lit-element/lib/decorators';
How does not re-exporting them make the bundle smaller?
Isn't the point also that you should import from lit
instead of lit-element
and lit-element
is mostly around for backwards compatibility?
The default entrypoint for lit
does not export decorators either so there is lit/decorators.js
That is completely fine as lit
is for new users. This is only a question for migration
The intention is that when you import 'lit-element'
, it is as backwards compatible as possible. We've changed some of the imports in the lit
package only.
https://github.com/Polymer/lit-html/pull/1649 fixes the problem here. We made lit-element
backwards compatible with a new index.js
file, but the typings still point to lit-element.js
which doesn't export the decorators.
The purpose of this change is so that vanilla users aren't taxed with extra decorators code in their bundles
fix:
import { html } from 'lit-element'; import { customElement, property, query } from 'lit-element/lib/decorators';
Actually, this is the one works for Lit V3:
import { html } from 'lit-element'; import { customElement, property, query } from 'lit-element/decorators';
Note: there is no lib folder.
Description
With LitElement 2.4 you can do
With Lit 2, this results in an error
Is it intentional that the decorators are not re-exported? Would ease migration if they were