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
feat: Lit templates in Vite dev and prod mode #12204
Conversation
try { | ||
FileUtils.copyFileToDirectory(source, target); | ||
} catch (IOException e) { | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CatchAndPrintStackTrace: Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
(at-me in a reply with help
or ignore
)
b595775
to
13648a4
Compare
13648a4
to
107fc95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we should not change webpack to work the same way at the same time?
...ontend/vite-production/src/main/java/com/vaadin/viteapp/views/template/PolymerComponent.java
Outdated
Show resolved
Hide resolved
vaadin-dev-server/src/main/java/com/vaadin/base/devserver/WebpackHandler.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/internal/DevModeHandler.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendUtils.java
Outdated
Show resolved
Hide resolved
vaadin-dev-server/src/main/java/com/vaadin/base/devserver/ViteHandler.java
Outdated
Show resolved
Hide resolved
...late/src/main/java/com/vaadin/flow/component/littemplate/internal/LitTemplateParserImpl.java
Outdated
Show resolved
Hide resolved
...late/src/main/java/com/vaadin/flow/component/littemplate/internal/LitTemplateParserImpl.java
Outdated
Show resolved
Hide resolved
...late/src/main/java/com/vaadin/flow/component/littemplate/internal/LitTemplateParserImpl.java
Outdated
Show resolved
Hide resolved
...ymer-template/src/main/java/com/vaadin/flow/component/polymertemplate/NpmTemplateParser.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/internal/DevModeHandler.java
Outdated
Show resolved
Hide resolved
89052fc
to
2492315
Compare
...late/src/main/java/com/vaadin/flow/component/littemplate/internal/LitTemplateParserImpl.java
Outdated
Show resolved
Hide resolved
571caf9
to
4724805
Compare
Dev mode: load template from devserver:port/VAADIN/template.ts Prod mode: copy templates to META-INF/VAADIN/config/templates/template.ts.ts
ecf962e
to
4618c48
Compare
This reverts commit f2a40ba.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine as long as the webpack functionality is validated on Bakery or other template heavy application.
@@ -236,7 +236,7 @@ module.exports = { | |||
devServer: { | |||
hot: false, // disable HMR | |||
client: false, // disable wds client as we handle reloads and errors better | |||
// webpack-dev-server serves ./ , webpack-generated, and java webapp | |||
// webpack-dev-server serves ./Frontend , webpack-generated, and java webapp | |||
static: [outputFolder, path.resolve(__dirname, 'src', 'main', 'webapp')], | |||
onAfterSetupMiddleware: function (devServer) { | |||
devServer.app.get(`/stats.json`, function (req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stats.json and stats.hash endpoins could be removed as they are not used anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also stats plugin can be removed and only have the generated stats.json
contain the result from ?stats.assetsByChunkName
but this cleanup can be in a different ticket that should be created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Ticket for the remaining refactoring here: #12301
import com.vaadin.flow.router.Route; | ||
|
||
@Route(TemplateView.ROUTE) | ||
public class TemplateView extends Div { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the TemplateView and TemplateIT are equal should we have a common package with tests that would be used by both development tests and production tests?
see flow-tests/test-embedding/embedding-test-assets
and flow-tests/test-embedding/embedding-test-assets
for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
flow-tests/test-frontend/pom.xml
Outdated
<module>embedding-test-assets</module> | ||
<module>addon-with-templates</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<module>embedding-test-assets</module> | |
<module>addon-with-templates</module> | |
<module>addon-with-templates</module> | |
<module>vite-test-assets</module> |
Copy paste name and wrong order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😣 , done
fbc6643
to
2f181f1
Compare
SonarQube analysis reported 14 issues Top 10 issues
|
Bakery verified working with this PR snapshot:
|
This ticket/PR has been released with platform 22.0.0.beta2 and is also targeting the upcoming stable 22.0.0 version. |
Dev mode: load template from file system (looking into
frontend
,@node_modules/@vaadin/flow-frontend
,@node_modules
(for paths not starting with./
)).Prod mode: copy templates to
target/classes/META-INF/VAADIN/config/templates
as part ofbuild-frontend
task. I.e., template sources are no longer gotten fromstats.json
.