vite-plugin-office-addin

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

Vite plugin for Office Add-in development. Copies and transforms manifest.xml during Vite builds. Latest version 2.1.0 supports Vite 4/5 and Node 18+. Provides dev-to-prod URL replacement via options or .env variables. Allows custom manifest paths and multiple manifest copying. Ships TypeScript types. Released under MIT.

error Error: The service is unavailable. Try again later. If the problem persists, contact your administrator.
cause manifest.xml not found at default path (project root).
fix
Specify the correct path: officeAddin({ path: 'src/manifest.xml' })
error TypeError: officeAddin is not a function
cause CommonJS require without accessing .default.
fix
Use const officeAddin = require('vite-plugin-office-addin').default
error Error: [vite] The plugin 'vite-plugin-office-addin' requires at least Vite 4.5.0.
cause Installed version 2.x with an older Vite.
fix
Upgrade Vite to >=4.5.0 or downgrade plugin to v1.x.
breaking Version 2.0.0 dropped support for Vite 2/3 and Node 14/16. Only Vite 4/5 and Node 18/20 supported.
fix Upgrade Vite to >=4.5.0 and Node to >=18.0.0.
gotcha Plugin only copies manifest.xml from project root by default. If your manifest is elsewhere, you must set the `path` option.
fix Configure with `officeAddin({ path: 'src/other-folder/manifest.xml' })`.
gotcha CommonJS require pattern: `const officeAddin = require('vite-plugin-office-addin')` returns a module with default property; using it directly as a plugin will cause Vite to throw an error.
fix Use `const officeAddin = require('vite-plugin-office-addin').default`.
deprecated Node 14 and 16 are no longer supported as of v2.0.0.
fix Update Node.js to version 18 or 20.
npm install vite-plugin-office-addin
yarn add vite-plugin-office-addin
pnpm add vite-plugin-office-addin

Basic setup: import default export and add to vite plugins array.

// vite.config.js
import { defineConfig } from 'vite'
import officeAddin from 'vite-plugin-office-addin'

export default defineConfig({
  plugins: [officeAddin()]
})