Skip to content
New issue

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

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

Already on GitHub? # to your account

Importing bb.js on CommonJS --> TypeError: loadModule is not a function #2042

Open
Savio-Sou opened this issue Sep 6, 2023 · 1 comment
Open
Labels
C-bb.js Component: bb.js - wrapping bberg in js T-bug Type: Bug. Something is broken.

Comments

@Savio-Sou
Copy link
Member

Savio-Sou commented Sep 6, 2023

Reproduce

  1. git clone https://github.com/Savio-Sou/noir-recursion.git
  2. cd noir-recursion
  3. yarn
  4. cd circuits/recursion
  5. nargo codegen-verifier
  6. nargo compile
  7. cd ..
  8. npx hardhat node
  9. (In a separate terminal at the same directory) NETWORK=localhost yarn build

Error

% NETWORK=localhost yarn build
...
- info Creating an optimized production build  
- info Compiled successfully
- info Collecting page data ..TypeError: loadModule is not a function
    at /.../noir-recursion/.next/server/pages/index.js:381:48

> Build error occurred
Error: Failed to collect page data for /
    at /.../noir-recursion/node_modules/next/dist/build/utils.js:1156:15 {
  type: 'Error'
}
- info Collecting page data .%

Additional context

Lines importing bb.js: https://github.com/Savio-Sou/noir-recursion/blob/1ecd09610e5ffc654d1d714e7871fa078edfca60/utils/noir/noirBrowser.ts#L8-L9

Might boil the example code into something more minimal if I find time. Wanted to flag early in case if we have any immediate insights.

cc @charlielye as it might be related to #1855.

@Savio-Sou Savio-Sou added T-bug Type: Bug. Something is broken. C-bb.js Component: bb.js - wrapping bberg in js labels Sep 6, 2023
@github-project-automation github-project-automation bot moved this to Todo in A3 Sep 6, 2023
@Savio-Sou
Copy link
Member Author

Not sure if it's the best workaround, but adding @ts-ignore as suggested here circumvented the error.

A solution to this issue could be updating the usage instructions in README to use @ts-ignore in replacement of loadModule if considered appropriate.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bb.js Component: bb.js - wrapping bberg in js T-bug Type: Bug. Something is broken.
Projects
Status: Todo
Development

No branches or pull requests

1 participant