wimdeblauwe/taming-thymeleaf-sources

Is it possible to use Webpack or Vite with Thymeleaf

Opened this issue · 2 comments

Hi,
I am just reading the book Taming Thymeleaf Practical Guide to building a web application with Spring Boot and Thymeleaf and overall it is a great book. I have learned so much new things.
I know that we can use also npm script for the npm-node part from your blog post. But I just tried to integrate webpack and also vite. But I couldn't find a proper way.

At least I can integrate webpack using the solution from https://bootify.io/frontend/webpack-spring-boot.html, but this solution re-loads all the javascript files when just one of the html page or javascript file changes. It isn't efficient.

And for the vite part, I even can't find any solution.

Then, is there any way to integrate either of these with Thymeleaf?

Glad you find the book useful!

I have no experience with Webpack or Vite, sorry. What would be the advantage over npm?

If you find it quite some work to set up a new project, you can use my CLI: https://github.com/wimdeblauwe/ttcli This will generate a Spring Boot with Thymeleaf project with the npm live-reload stuff.

I can't remember exactly the problem. But some of the npm packages cause an error "import declarations may only appear at top level of a module" (I can not use npm packages as it is)