Open jchavarri opened 1 year ago
What about promoting all js?
That could work. I personally haven't tested promotion mode much (or at all 😅 ) with Melange. But even if I had, it has a couple of downsides:
js
files are not co-located with sources using promotion either. If you have a lib in foo/bar
and a melange emit stanza in baz
with target output
, the js files for the library will be in baz/output/foo/bar
. Still quite far from the sources. @anmonteiro had some attempts to remove target
in https://github.com/ocaml/dune/pull/6541, but I'm not sure it's feasible in the short term.This is a bit tricky because e.g. a library libA
can be included in multiple melange.emit
s, so there will be several JS targets for it. If we were to implement this, we'd need to find all the targets where it appears and list them under the respective melange.emit
stanzas that they belong to.
Dune and Melange default to placing
.js
artifacts in_build
folder. In comparison, ReScript default behavior is to put.js
artifacts next to the sources.To help Melange users look at the resulting
.js
files, it would be nice to have the ability to "Inspect JavaScript output" from editors. To do so, Dune could look up all themelange.emit
stanzas in the workspace and search for the given module emitted in them. Then editor tooling libraries could consume this functionality through rpc.