Skip to content

Vite

Use the Vite plugin for automatic wrapping of observable reads in JSX.

Terminal window
npm install -D @usels/vite-plugin-legend-memo
vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { autoWrap } from '@usels/vite-plugin-legend-memo';
export default defineConfig({
plugins: [
autoWrap(),
react(),
],
});
  • Place autoWrap() before react().
  • Use this path unless you have a Babel-first build pipeline.