I’ve been using Vaadin (JAVA) for a while now. It’s great, being served from a Tomcat servlet container. For another project I need to develop a “nice” user-interface that can be served from a simple HTTP server (just serving files, no servlet container or anything). I was thinking of using the Vaadin web components.
Hence, I’ve been experimenting a bit with these. So I learned that these components use “bare Javascript import statements”, which are not supported by browsers. This is supported by node.js (running server side) though. A solution could be to take the web component Javascript code and modify all input statements to be compliant to what is supported by a browser. However … modifying code like this is not a “good software practice” and question is whether it is even allowed by the Vaadin web component’s license.
If anybody has suggestions/feedback … very appreciated.
Hi. We recommend using ES dev server for the development. It handles the bare import specifiers transform, as well as transpiling code for older browsers (that don’t have ES modules implemented).
The server is meant to be used for development only, and for production build you could have a very simple build with [Rollup]
(https://open-wc.org/building/#rollup) that would handle the imports, minify JS and HTML etc.
Thanks a lot for your reply. I didn’t know something like webpack and rollup existed. Just for your info … I ended up using only webpack. Webpack allows both packaging and minification:
Install webpack and the babel minify pluging using NPM: