JS file format of (js_of_ocaml (javascript_files ...))

dune file:

(library
 (name code_mirror)
 (js_of_ocaml (javascript_files ./babel_out.js))
 (libraries brr js_of_ocaml))

Now, what format is “babel_out.js” expected to be in ?

Consider the following Makefile:

default:
	# esbuild includes.js --target=es6 --format=esm --bundle --outfile=out.js
	esbuild includes.js --bundle --outfile=es_out.js
	./node_modules/@babel/cli/bin/babel.js es_out.js --config-file ./babel.config.js -o babel_out.js

jsoo is NOT happy with the file es_out.js (parsing error), but okay with the file babel_out.js

My babel.config.js is:

 cat babel.config.js 
module.exports = {
  presets: ["@babel/env"],
  plugins: ["@babel/transform-property-mutators"],
  compact: true
};

===

I’m trying to drop the babel.js step and only use esbuild, as esbuild is very fast and babel.js is very slow.

The next version of jsoo will come with improved support for es6 (see Compiler: modernize js parser by hhugo · Pull Request #1391 · ocsigen/js_of_ocaml · GitHub). In short, export and import syntax are still missing.

Okay, I guess this is the point of plugins: ["@babel/transform-property-mutators"], from babel.config.js ? Do you know if there is a way to do this from esbuild ? Googling brings up babel, but not esbuild solutions. Thanks!