Custom Functions Metadata WebPack Plugin

raw JSON →
2.1.7 verified Sat Apr 25 auth: no javascript

A WebPack plugin (v2.1.7) for Office Add-ins that generates the metadata JSON file required by Excel custom functions. It pairs with the Custom Functions runtime to define function names, parameters, and descriptions. This plugin is specific to the Office Add-in development lifecycle and requires WebPack 5. It is part of the Office-Addin-Scripts monorepo maintained by Microsoft. Key differentiators: it auto-generates metadata from JavaScript/TypeScript comments, integrates tightly with WebPack 5, and is the official Microsoft tool for enabling Excel custom functions in web add-ins.

error Error: 'input' is required
cause Missing input option in plugin configuration.
fix
Add input: './path/to/functions.js' to the plugin options.
error Error: Module parse failed: Unexpected token (1:0)
cause WebPack cannot parse the input file (likely not a valid JS/TS module).
fix
Ensure input file exports functions with JSDoc comments and is a valid module.
breaking Requires WebPack 5, not compatible with WebPack 4.
fix Update WebPack to version 5 or stay on plugin v1.x.
gotcha Input file must contain JSDoc-style comments for each custom function. Without comments, metadata will be empty.
fix Add @customfunction JSDoc tag and parameter descriptions to each exported function.
deprecated Plugin is part of a monorepo that also contains office-addin-manifest; manifest modifications moved to a separate command in v1.1.0.
fix Use `office-addin-manifest modify` for manifest changes instead of relying on this plugin.
npm install custom-functions-metadata-plugin
yarn add custom-functions-metadata-plugin
pnpm add custom-functions-metadata-plugin

Shows how to add the plugin to a WebPack config to generate Excel custom functions metadata from a source file.

const CustomFunctionsMetadataPlugin = require('custom-functions-metadata-plugin');

module.exports = {
  // ... other webpack config ...
  plugins: [
    new CustomFunctionsMetadataPlugin({
      input: './src/functions.js',
      output: './dist/functions.json'
    })
  ]
};