How to config the output js file position in rescript

I am new to ReScript.
Is there a config option that I can decide where to emit my js file?
Now it builds parallel with my rescript file, I can not find any option to decide it.

There’s no such an option. Could you share why you need it?

Thx for reply.
I am just annoying that the output file is mixed with the res file.

But I just thought that if I want to publish a js package, for js ecosystem, it is common to emit the file to the dist dir and publish it only. But if there is no option for rescript, we may write some script to do it. I do not know I think is correct or false.

Or in web app situation, we always upload our bundled file in one dir possibly public/ or something else. Also, I have to admit that web app situation can be solved by bundler like webpack, rollup, so this may not be a big problem.

It’s actually convenient, allowing you to check the generated JS code quickly. Sometimes it is needed to debug or check how your code actually works.

For publishing a package for JS ecosystem, you need to use a bundler. I personally like microbundle. The main reason is to support both commonjs and ESM users. It also creates the dist directory making the package convenient to publish.

You’re right, usually there’s a bundler for applications.

1 Like

If you use VSCode, you can nest generated JS files inside of ReScript ones.

https://dev.to/this-is-learning/file-nesting-in-vs-code-46l5

1 Like

You can either have the generated JS alongside the source files, or put in the lib/js directory.

See the package-specs build option:

"in-source": true generates output alongside source files. If you omit it, it’ll generate the artifacts into lib/js. The output directory is not configurable otherwise.

1 Like

Oh, completely forgotten about the configuration. Thank you for correcting my answer.

1 Like

No worries…though I don’t think even using that option answers OP’s real question about having the output location be totally configurable. Which as you said is not possible to choose whatever location you want.

1 Like

Thx for reply, i miss this option too :joy:

Though it still not solve my problem.

Thx a lot! I will learn this repo later.

This is a fair point. Maybe just like prettier, less magic is more transparency.