Skip to content

barretenberg top-level await fails doesn't match its target #4322

@signorecello

Description

@signorecello

barretenberg top-level await makes NoirJS break in 0.23.0

Gonna expand a bit, this is what I think is happening:

How to reproduce

  1. git clone https://github.com/noir-lang/noir-starter.git
  2. cd noir-starter
  3. git switch zpedro/0.23.0
  4. cd vite-hardhat
  5. yarn
  6. cp .env.example .env
  7. npx hardhat node
    In a different terminal, in noir-starter/vite-hardhat:
  8. yarn install
  9. NETWORK=localhost yarn dev

Error log in terminal

% NETWORK=localhost yarn dev

Nothing to compile
Nothing to compile
(node:20211) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm/transpile-only", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:20217) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm/transpile-only", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
Deployed at {
  chainId: 31337,
  verifier: '0x5fbdb2315678afecb367f032d93f642f64180aa3'
}

  VITE v5.0.6  ready in 246 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
✘ [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

    node_modules/@aztec/bb.js/dest/browser/index.js:2:16426468:
      2 │ ...e.hasOwnProperty.call(A,I);var D=E(183),i=(D=await D).Zh,w=D.AL,h=D.i2,o=D.Fr,G=D.ld;export{i a...
        ╵                                                 ~~~~~

/.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1650
  let error = new Error(text);
              ^

Error: Build failed with 1 error:
node_modules/@aztec/bb.js/dest/browser/index.js:2:16426468: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
    at failureErrorWithLog (.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1650:15)
    at /.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1058:25
    at /.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1526:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v20.11.

Metadata

Metadata

Assignees

Labels

C-bb.jsComponent: bb.js - wrapping bberg in js

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions