Is it generally safe to replace jsoo_minify with esbuild?

Is it generally safe to replace jsoo_minify with esbuild ?

The goal here is not speed. The goal here is: I’m already running esbuild on the project, and I’m wondering if there is any danger in replacing the jsoo_minify calls with esbuild (and handling it in the sbuild script instead of dune).

Thanks!

I thought I already answered your question in Replace jsoo/link with cat or esbuild? - #4 by hhugo.

Using esbuild instead of js_of_ocaml link can change the behavior of the program because it can change the set of compilation units linked (and change the program by side-effect).

1 Like

Not to be pedantic – is jsoo_minify and js_of_ocaml link the same thing? I genuinely don’t know.

This question is about jsoo_minify.

Replace jsoo/link with cat or esbuild? - #21 by zeroexcuses is about js_of_oaml link, and with exception of a backlink to this post, the word 'minify does not appear to appear on that page.

Or are you implying that jsoo_minify does more than just minifying JS code, but also calls js_of_ocaml link as part of jsoo_minify it self ? I’m genuinely not seeing how jsoo_minify and js_of_ocaml link are related.

I misread the question, sorry.

Jsoo_minify is a general purpose minifier. Is has little to do with jsoo. It’s more a PoC than an end user tool.

Note that jsoo does minify it’s output by default. Before you ask, minification is disabled in dune when doing separate compilation to speed up the feedback loop and make debugging easier.

For production, you should build with dune build --profile release which performs minification

1 Like

Thanks, this clarifies everything. I was playing with try-eio/dune at main · patricoferris/try-eio · GitHub , but already using esbuild, and was seeing if I could move those lines into the esbuild script instead, and everything appears to work fine. Thanks!