DEV Community

Kevin Jump
Kevin Jump

Posted on

2

Umbraco Early Adopters Gotcha - use @umbraco lit

Things i keep getting wrong part n+1

when you are developing your elements and contexts for the new Umbraco backend - visual studio code is very good at auto inserting all the import statements for you.

import { UmbModalBaseElement, UmbModalToken } from "@umbraco-cms/backoffice/modal";
import { html } from "lit";
import { customElement } from "lit/decorators.js";
Enter fullscreen mode Exit fullscreen mode

the vite process then does a good job of working out what needs to be included in your js files.

but Umbraco already has the lit library as an external reference.
if you swap out your lit library references out for umbraco ones.

import { UmbModalBaseElement, UmbModalToken } from "@umbraco-cms/backoffice/modal";
import { html, customElement } from "@umbraco-cms/backoffice/external/lit";
Enter fullscreen mode Exit fullscreen mode

It's not a lot but if you do this then your compiled javascript will smaller as it won't need to include any lit methods you've used as they will be in the umbraco libraries.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay