Closed andreasrosdal closed 1 year ago
For starters, I've got a test case that shows how to build a bundle with an ESM library src/test/resources/projects/nodemodules (pom, parent pom) Does that help you?
But essentially, the usual approach for ESM (or any module system really) is that you do not specify all files that you want to include in the final bundle, but only a single entry point (e.g. an index.js
file, <closureDependencyEntryPoints>
). That entry point then imports everything it needs, which lets the bundler discover all the files it needs to bundle. Closure compiler I believe additionally requires that you tell it about all possible source files (<includes>
), so that it knows where to find imported files (it will only include those files reference by the entry point, but it needs to know about all files).
Closing this for now, feel free to reopen if you have any further questions.
I am using this closure-compiler-maven-plugin to build and bundle the JavaScript files for an open source game called FCIV.net. I now need to update the maven pom file to use ES modules in order to continue using the Three.js 3D engine.
The GitHub project page: https://github.com/fciv-net/fciv-net
FCIV.NET Maven pom file: https://github.com/fciv-net/fciv-net/blob/main/freeciv-web/pom.xml
This is the Three.js maven module source: https://github.com/mrdoob/three.js/blob/dev/build/three.module.js
So the question is, how can I update my pom file in order for the closure-compiler-maven-plugin to find and build the Three.js ES module? How should I modify the game JavaScript source code in order to include and use the new Three.js ES module?