Skip to content

Compilation error in Vaadin 24.3.0 (incomatibility with newer version of Lit) #82

@gbi

Description

@gbi

The compilation of the frontend fails with the following error:

[ERROR] "customElement" is not exported by "node_modules/lit-element/index.js", imported by "frontend/generated/jar-resources/fc-xterm/xterm.ts".  
[ERROR] file: frontend/generated/jar-resources/fc-xterm/xterm.ts:20:9  
[ERROR] 18:  * #L%  
[ERROR] 19:  */  
[ERROR] 20: import { customElement } from 'lit-element';
[ERROR]              ^
[ERROR] 21: 
[ERROR] 22: import { XTermElement } from './xterm-element';

The compilation is successful with Vaadin 24.2.5.

I think, that I have traced the error down to the following:
With the update of Vaadin to version 24.3.0 also comes the update of Vaadin Web Components to version 24.3.0 (see Vaadin 24.3.0 Changelog). The new version of Vaadin Web Components bumps Lit to version 3.0.0 (see Vaadin Web Components Changelog). Since Lit 3.0 the re-export of decorators from lit-element is removed (see Lit 3 upgrade guide). There, it is stated that 'customElement' is not exported by 'lit-element' anymore.

The solution provided in the upgrade guide is to change the line 20 from
import { customElement } from 'lit-element';
to
import { customElement } from 'lit/decorators.js';

Build Environment

  • Maven
  • Java 17
  • node.js v20.10.0
  • Vaadin 24.3.0
  • XTermConsoleAddon 2.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions