Vite & Vue.js

This section lists some common compatibility requirements and how to address them

Running into an issue and don't see something here? Get in touch!

Vite + Vue.js

Capsule's SDKs depend on some plugins to function properly so you may need to make some adjustments to your vite.config.ts file to integrate Capsule. If you're using React and would like to leverage our React components in @usecapsule/react-sdk, then you'll need a React plugin as well.

import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import react from '@vitejs/plugin-react-swc'; // only needed if working with React
...

export default defineConfig({
  plugins: [
    nodePolyfills(),
    react(), // only needed if working with React
    ...
  ],
  ...
});

Depending on your setup, you may need to pass the following polyfill arguments to nodePolyfills()

nodePolyfills({
  exclude: ["fs"],
  globals: {
    process: true,
  },
  protocolImports: false,
}),

Last updated