Skip to content

SDK Installation

Current version: @holyheld/sdk@4.1.5 · npm · changelog

Requirements: Node.js 18+

You can add the Holyheld SDK to your project using any package manager:

bash
npm install @holyheld/sdk
bash
yarn add @holyheld/sdk
bash
pnpm add @holyheld/sdk

Node.js Buffer polyfill

The SDK requires a Node.js Buffer global. In Node.js environments this is available automatically. In browser bundlers that do not include Node.js built-ins (Webpack 5, Vite), you must add a polyfill.

Vite

Install the polyfill package and update vite.config.ts:

bash
npm install --save-dev vite-plugin-node-polyfills
bash
yarn add --dev vite-plugin-node-polyfills
bash
pnpm add --save-dev vite-plugin-node-polyfills
typescript
// vite.config.ts
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';

export default defineConfig({
  plugins: [
    nodePolyfills({
      include: ['buffer'],
    }),
  ],
});

Webpack 5

Webpack 5 removed automatic Node.js polyfills. Configure resolve.fallback in your webpack config:

javascript
// webpack.config.js
const { ProvidePlugin } = require('webpack');

module.exports = {
  resolve: {
    fallback: {
      buffer: require.resolve('buffer/'),
    },
  },
  plugins: [
    new ProvidePlugin({
      Buffer: ['buffer', 'Buffer'],
    }),
  ],
};

Install the buffer package if not already present:

bash
npm install --save-dev buffer
bash
yarn add --dev buffer
bash
pnpm add --save-dev buffer

Next.js

Next.js is based on webpack 5. Apply the webpack config above inside next.config.js under config.resolve.fallback using the webpack option.