What is the purpose of the decorators that were removed in the latest version of 0.17?
Closed this issue · 3 comments
All the customElement decorators are removed because it is hard to tell which lit component is actually used during tree-shaking process. So we replace it with the effect
function for each component to register component manually, so now if you actually need the component you should import the correspond effect
function and execute it.
All the customElement decorators are removed because it is hard to tell which lit component is actually used during tree-shaking process. So we replace it with the
effect
function for each component to register component manually, so now if you actually need the component you should import the correspondeffect
function and execute it.所有的 customElement 装饰器都被删除了,因为很难判断在 tree-shaking 过程中实际使用了哪个 lit 组件。所以我们为每个组件替换effect
函数来手动注册组件,所以现在如果你真的需要这个组件,你应该导入对应的effect
函数并执行它。
After I manually registered the effects function, I found that the doc-title could be rendered, but the page-editor would throw an error.
This is a demo of reproduction. https://github.com/xiaogonggong-w/blocksuite-demo
You need to call the effects
before initializing editors:
import { effects as blocksEffects } from '@blocksuite/blocks/effects';
import { effects as presetsEffects } from '@blocksuite/presets/effects';
blocksEffects();
presetsEffects();
// init editor container now