Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] More customization (or documentation) of --source-map. #1613

Open
JasonGross opened this issue May 13, 2024 · 1 comment
Open

Comments

@JasonGross
Copy link

Is your feature request related to a problem? Please describe.

In the build system for my project, I generate a couple different versions of the .byte files, and then pick one and install it, renaming it in the process. When this happens, it seems like the .map files refer to the wrong files (and locations).

Describe the solution you'd like

I'd like the documentation to specify the constraints on correct use of --source-map, and, ideally, for the generated files to either be relocatable and renamable, or for js_of_ocaml to take options that tell --source-map how files will be relocated and renamed.

Questions that are not made clear in the documentation:

  • does the .byte file have to have the same stem that the .js file will eventually have for --source-map to work correctly?
  • do I have to call js_of_ocaml on a .byte file whose directory relative to the cwd is the same as what it will be on the website I'm building, for --source-map to work? (it seems that it bakes in relative paths...)

Describe alternatives you've considered

@hhugo
Copy link
Member

hhugo commented May 13, 2024

does the .byte file have to have the same stem that the .js file will eventually have for --source-map to work correctly?

You can control the name of the generated file with -o FILE. When using source-map, the source-map filename is derived from the generated filename.
For example, js_of_ocaml main.byte --source-map -o jsfile.js will generate a js file jsfile.js referencing a source-map file jsfile.map.

do I have to call js_of_ocaml on a .byte file whose directory relative to the cwd is the same as what it will be on the website I'm building, for --source-map to work? (it seems that it bakes in relative paths...)

By default, jsoo embed sources inside the sourcemap file to ease its usage. If you don't embed the sources, Don't you have the sources embeded ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants