Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vite] Export web components must work #12057

Closed
gilberto-torrezan opened this issue Oct 15, 2021 · 2 comments · Fixed by #12259
Closed

[Vite] Export web components must work #12057

gilberto-torrezan opened this issue Oct 15, 2021 · 2 comments · Fixed by #12259
Assignees
Labels
enhancement vite Tickets related to vite support

Comments

@gilberto-torrezan
Copy link
Contributor

How does it work today

  • An "export" bundle is created with everything used from exported components - this needs to be verified
    • For each WebComponentExporter a .js file is generated into {build.folder}/frontend and added as an import statement to the generated-flow-imports.js

How could it work

  • In a similar way by creating multiple bundles
@gilberto-torrezan gilberto-torrezan added enhancement vite Tickets related to vite support labels Oct 15, 2021
@gilberto-torrezan gilberto-torrezan added this to To do in Frontend build optimization via automation Oct 15, 2021
@caalador
Copy link
Contributor

caalador commented Nov 2, 2021

Note. The current exported webcomponents uses v14 bootstrapping so it depends on stats.json to get the bundlefile name.

For a production mode build in flow-test-embedding-generic you get:

com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
        at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:863)
        at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupDocumentHead(BootstrapHandler.java:753)
        at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.getBootstrapPage(BootstrapHandler.java:628)
        at com.vaadin.flow.server.communication.WebComponentBootstrapHandler.synchronizedHandleRequest(WebComponentBootstrapHandler.java:224)

@caalador
Copy link
Contributor

caalador commented Nov 3, 2021

The exported component would seem to work as long as the BootstrapHandler::appendNpmBundle is made to get the correct bundle file. In production mode we could at the moment probably read that from the classpath, but where could we get the info in development mode?
Should we parse the index.html for all the required bundles perhaps?

@caalador caalador self-assigned this Nov 3, 2021
caalador added a commit that referenced this issue Nov 3, 2021
Support vite build in the v14 bootstrap
to have exported webcomponents working.

Closes #12057
@caalador caalador moved this from To do to In progress in Frontend build optimization Nov 3, 2021
caalador added a commit that referenced this issue Nov 5, 2021
Support vite build in the v14 bootstrap
to have exported webcomponents working.

Closes #12057
caalador added a commit that referenced this issue Nov 8, 2021
Support vite build in the v14 bootstrap
to have exported webcomponents working.

Closes #12057
Frontend build optimization automation moved this from In progress to Done Nov 11, 2021
Artur- pushed a commit that referenced this issue Nov 11, 2021
Support vite build in the v14 bootstrap to have exported webcomponents working.

Closes #12057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement vite Tickets related to vite support
Development

Successfully merging a pull request may close this issue.

2 participants