Closed jchavarri closed 4 months ago
I have updated the PR to support both Webpack and Esbuild, via a new flag -bundler
that can be passed to melange.ppx
.
For now the generated filenames follow the default name scheme used on each bundler case. We can add more features later on while testing, e.g. file templates like [name][hash][ext]
like some bundlers do, or the ability to add prefixes to resulting filenames.
I also have left some failed attempt to produce Rspack hashes commented, as currently rspack doesn't support proper content hashes.
I decided to not include tests against the actual Webpack or Esbuild bundlers hashes because these hashes should not change over time, and it would slow down and complicate the test suite quite a bit.
This PR adds initial support to compile externals like:
Into something like:
~The output file naming follows esbuild default shape and hash function. There is no option to configure anything else for now, we can slowly introduce as needed.~ Edit: the ppx now support choosing either
-bundler esbuild
or-bundler webpack
. The default is webpack.I decided to vendor the libraries
base32
andxxhash
for simplicity, to avoid forcing consumers to pin or download new packages, as they are quite small libraries and the versions that were needed are not available in opam.