Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
src/main
README.md
package.json
pom.xml
webpack.config.js
yarn.lock

README.md

WebPack Frontend Example

This project illustrates how to configure the Vert.x Maven Plugin to develop a web application using WebPack as frontend technology. It repackages the web resources when they change.

Anatomy

The project uses the frontend Maven plugin to install Node, Yarn and execute WebPack. The node_modules is located in the target directory.

In addition to the pom.xml file, the webpack.config.js handle the web resource packaging. The package.json contains the dependencies.

Redeployment

First, launch the application in redeploy mode using:

mvn compile vertx:run

On the first start, it downloads node, yarn, and web pack. Then it compiles the Java classes and the web resources. This compilation is described in webpack.config.js. The output is copied to target/classes/webroot so it is served by the Vert.x application.

Changing the Java source or the JavaScript source triggers the redeployment. Enjoy!

Packaging

Package the application using:

mvn clean package

The fat-jar is executable, so run it using:

java -jar target/frontend-example-0.1-SNAPSHOT.jar 

Hit CTRL+C to stop the process.