gwtgwt-elemental

GWT No source code is available for type elemental2.dom.Element; did you forget to inherit a required module?


I'm trying to get a div element with ID="calendarJS" and pass it to a constructor.

import elemental2.dom.Document;
import elemental2.dom.Element;
.
.
.
Element calendarEl = new Document().getElementById("calendarJS");

After loading the page the GWT compiler shows this error:

.
.
.
[ERROR] Line 133: No source code is available for type elemental2.dom.Element; did you forget to inherit a required module?
[ERROR] Line 133: No source code is available for type elemental2.dom.Document; did you forget to inherit a required module?
.
.
.

What do I miss?

I have the elemental2-promise, elemental2-dom and elemental2-core in my pom.xml


Solution

  • As the error says, did you forget to inherit the module in your .gwt.xml file? Adding it to the pom isn't enough.

    You need to have

    <inherits name="elemental2.dom.Dom"/>
    

    in your .gwt.xml file to specify that you will use those sources.