Skip to main content

Installation

Package Installation

Install the Privacy Boost TypeScript SDK using your preferred package manager:

Bundler Configuration

The SDK includes WebAssembly (WASM) modules that require specific bundler configuration.

Vite

Vite works out of the box. No additional configuration needed.

Webpack 5

Add the following to your webpack.config.js:

Next.js

Add to your next.config.js:
For App Router, also add to your layout:

Create React App

CRA requires react-app-rewired to modify webpack:
Create config-overrides.js:
Update package.json scripts:

Rollup

esbuild

Content Security Policy

If your application uses CSP, add the following directives:

TypeScript Configuration

Recommended tsconfig.json settings:

Node.js Usage

For Node.js applications:
Ensure you’re using Node.js 18+ which includes native fetch support. For Node.js < 18, add a fetch polyfill:

Verifying Installation

Test your installation:

Troubleshooting

”WebAssembly is not defined”

Ensure your bundler supports WebAssembly and you’re running in a browser or Node.js environment that supports WASM.

”Failed to load WASM module”

Check that:
  1. Your bundler is configured correctly
  2. The WASM file is being served with the correct MIME type (application/wasm)
  3. Your CSP allows wasm-unsafe-eval

TypeScript errors

Ensure you have TypeScript 4.7+ and the correct moduleResolution setting in tsconfig.json.

Next Steps