vite-legacy-interop - v1.0.3
    Preparing search index...

    Function legacyInterop

    • Vite plugin that intercepts subpath imports of legacy CJS libraries and wraps them in ESM-compatible virtual modules, preventing CommonJS interop errors at runtime with Rolldown.

      Supports nested subpaths (e.g. lib/Grid/Column) and is configurable per library.

      Parameters

      Returns Plugin

      // vite.config.ts
      import { defineConfig } from 'vite'
      import { legacyInterop } from 'vite-legacy-interop'

      export default defineConfig({
      plugins: [
      legacyInterop({
      libs: ['legacy-lib', { name: 'other-legacy-lib', libDir: 'dist' }],
      showLog: true,
      }),
      ],
      })