Skip to content

[BUG] Generated code includes "node:util" with target-env=browser #2127

@rizo

Description

@rizo

Opening this as a dedicated issue, since this has been preventing me from upgrading to the latest version.

I noticed a related issue. My js files contain references to node even when compiled for the browser target.

This only happens with the dev profile. With release, the issue is gone.

dune:

(executable (name test) (modes js) (js_of_ocaml (flags (:standard --target-env browser)) (build_runtime_flags (:standard --target-env browser)))) 

Produces a js file with "node:util":

$ dune build tests/test.bc.js; cat _build/default/tests/test.bc.js | grep 'node:util' const util = require("node:util"); 

Versions

$ dune --version 3.20.2 $ dune exec -- js_of_ocaml --version 6.2.0 

If this is something new, happy to open a separate issue and help with investigation.

Originally posted by @rizo in #1809

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions