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

resolve buffer #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

resolve buffer #1

wants to merge 1 commit into from

Conversation

kevinwilde-at
Copy link

When I run the app as is I see

Module not found: Error: Can't resolve 'buffer' in '/Users/kevin.wilde/h/source/airtable-rpc/node_modules/safe-buffer'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
	- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "buffer": false }.

Following these instructions, I

  • npm install buffer
  • Now I want to add the fallback they mention. To do this, I can use @airtable/blocks-webpack-bundler.
  • npm install --save-dev @airtable/blocks-webpack-bundler
  • Create bundler.js with the resolve fallback the error message mentioned
  • Update block.json to point to this custom bundler.

With these changes, the app no longer errors when importing buffer. Instead it errors on account being undefined in frontend/index.js, which looks like a legitimate error.

const account_id = nearConfig.contractName;
const contract = await new nearAPI.Contract(
account,
account, // undefined variable - maybe walletConnection.account() ?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where it errors now

@Ellweb3
Copy link
Owner

Ellweb3 commented Mar 31, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants