embedding Flow components into TypeScript views does not work
See original GitHub issueIf I follow the Creating an Embedded Vaadin Application Tutorial in order to embed a server-side Vaadin component into a TypeScript Vaadin view, my application does not work as expected:
- the tutorial tells me that I need to include the
webcomponents-loader
script and gives code snippets how to do that. These code snippets do not work. Moreover, the entire step of loading WebComponents polyfils is not needed because all browsers supported by Vaadin 15+ do support Web Components natively. - If I skip the WC polyfils (or if I manage to find my way to load them), embedding still fails with a
Uncaught TypeError: window.Vaadin.Flow.initApplication is not a function
error:
ServerCounter.java:
public class ServerCounter extends Div {
public ServerCounter() {
add(new Label("Server-side counter"));
}
public static class Exporter extends WebComponentExporter<ServerCounter> {
public Exporter() {
super("server-counter");
}
@Override
protected void configureInstance(
WebComponent<ServerCounter> webComponent,
ServerCounter counter) {
}
}
}
index.html:
<script type="module" src="web-component/server-counter.js"></script>
main-layout.ts:
render() {
return html`
<server-counter></server-counter>
<slot></slot>
`;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
embedding Flow components into TypeScript views does not work
the tutorial tells me that I need to include the webcomponents-loader script and gives code snippets how to do that. These code snippets...
Read more >Embed the management of flows in a Typescript React App
How to use the authenticated Flow SDK to allow users to create and manage flows directly in a typescript application? As mentioned in...
Read more >Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >From object to iframe — other embedding technologies
A long time ago on the Web, it was popular to use frames to create websites — small parts of a website stored...
Read more >Creating a Simple Component | Using Templates | Flow - Vaadin
The first step is to create the LitElement TypeScript template file on the client side in frontend/src/hello-world.ts .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Another use case for cross-app embedding: gradual migration from an older Vaadin app to Fusion: want to embed parts of the old app inside the new app, without putting the old and the new app into one project.
A working example can be found here https://artur.app.fi/embed-fusion-flow/. Code here https://github.com/Artur-/embed-fusion-flow