Skip to content

[BUG] Compiling using --profile=release leads to runtime errors #1514

Closed
@xvw

Description

@xvw

Describe the bug
At @funkywork, we're working on a collection of tools to interact with Tezos. We recently realized that when using our libraries, producing JavaScript artifacts with the release profile generates incorrect JavaScript output. For example, in this project (I think it's pretty minimal): https://github.com/funkywork/tezos-dapps-examples/tree/main.
Using dune build; dune exec bin/server/dapps.exe and going to http://localhost:8888/dapps/connect launch properly the apps. But if you run dune build --profile=release; dune exec bin/server/dapps.exe you will have an error console:

12:10:45.847 Uncaught SyntaxError: missing ) after argument list client.bc.js:4635
12:10:45.848 Uncaught ReferenceError: nightmare_js is not defined
    <anonymous> http://localhost:8888/dapps/connect:2
connect:2:358
12:10:45.848 Uncaught ReferenceError: nightmare_js is not defined
    <anonymous> http://localhost:8888/dapps/connect:2
connect:2:465

And here is the client.bc.js generated: https://gist.githubusercontent.com/xvw/d679d490d085e671f926e106cfff37b5/raw/69c2c552065c0466a93a4c05b323ccf75c6ef01a/client.bc.js

From a development point of view, this isn't a problem, but it does make it difficult to put things into production, as the non-release bundle weighs in at ~16mb, compared with ~2mb for release.

If I can provide any additional information, or create a smaller example, please don't hesitate to ask!

Versions

  • ocaml: 5.0.0
  • js_of_ocaml: 5.4.0+git-e0d000e-dirty

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions