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

bigint: Failed to load bindings #25159

Assignees

Comments

@Juici
Copy link

Juici commented May 12, 2022

Problem

Currently import of @solana/web3.js will result in a console.warn of:
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)

This is due to rollup bundling the bigint-buffer package from the @solana/buffer-layout-utils dependency. bigint-buffer has a native module which it attempts to import:

if (!process.browser) {
  try {
    converter = require('bindings')('bigint_buffer');
  } catch (e) {
    console.warn(
        'bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)');
  }
}

The problem is that the above code relies on the native module existing in the correct location in the package it is run in. Since rollup bundles the require into @solana/web3.js the native module will never exist and will always result in the warning.

Proposed Solution

bigint-buffer can be added to the list of dependencies prevented from bundling in rollup.config.js.

@steveluscher
Copy link
Contributor

Thanks for the report! So, I suppose that the error being caught in the catch block was ‘Could not load the bindings file…’ right?

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