zmp-vite-plugin

raw JSON →
1.1.6 verified Mon Apr 27 auth: no javascript

A Vite plugin for Zalo Mini App development that integrates with the standard Vite build pipeline. Current stable version is 1.1.6, released under an active maintenance cadence. The plugin automatically reads app-config.json, supports React and vendor chunk splitting, and works with Vite 4 or 5. It simplifies deployment via zmp-cli and is the official Vite integration for Zalo Mini Apps, distinct from other mini-app frameworks.

error Cannot find module 'zmp-vite-plugin'
cause Plugin not installed or in devDependencies
fix
Run: npm i -D zmp-vite-plugin
error TypeError: zaloMiniApp is not a function
cause Importing named export instead of default
fix
Change to: import zaloMiniApp from 'zmp-vite-plugin'
error Unhandled rejection: TypeError: Cannot read properties of undefined (reading 'name')
cause app-config.json missing or malformed
fix
Create a valid app-config.json in project root.
gotcha The plugin reads app-config.json by default; providing options object overrides this.
fix Either rely on app-config.json or pass explicit options to the plugin.
gotcha Requires Vite ^4.2.0 || ^5.0.0. Using other Vite versions may cause incompatibility.
fix Ensure Vite version matches peer dependency.
gotcha Plugin is ESM-only; not compatible with CJS Vite configs unless using dynamic import.
fix Use ESM syntax (import/export) in vite.config.ts or use dynamic require with .default.
npm install zmp-vite-plugin
yarn add zmp-vite-plugin
pnpm add zmp-vite-plugin

Shows how to set up the plugin in a Vite config with React and vendor chunk splitting.

// vite.config.ts
import { defineConfig, splitVendorChunkPlugin } from 'vite';
import react from '@vitejs/plugin-react';
import zaloMiniApp from 'zmp-vite-plugin';

export default () => {
  return defineConfig({
    plugins: [
      react(),
      splitVendorChunkPlugin(),
      zaloMiniApp(),
    ],
  });
};