rollup-plugin-jsdoc
raw JSON → 0.1.2 verified Mon Apr 27 auth: no javascript
A Rollup plugin that wraps JSDoc to generate API documentation during the build process. Version 0.1.2 is the latest release and appears to be in early development with low release cadence. It passes JSDoc CLI options through Rollup, allowing integration of documentation generation into the build pipeline. Differentiators: minimalistic, no magic, direct JSDoc configuration.
Common errors
error Error: Cannot find module 'jsdoc' ↓
cause JSDoc not installed as dependency.
fix
npm install -D jsdoc
error TypeError: jsdoc is not a function ↓
cause Incorrect import style (named import instead of default).
fix
import jsdoc from 'rollup-plugin-jsdoc'
Warnings
gotcha Do not use '-c' or '--configure' in 'args' – use the 'config' option instead. ↓
fix Move configuration file path to the 'config' option.
gotcha JSDoc must be installed separately as a devDependency. ↓
fix Run: npm install -D jsdoc
deprecated Plugin is in early stage and may have breaking changes without major version bump. ↓
fix Pin version with exact version or use lockfile.
Install
npm install rollup-plugin-jsdoc yarn add rollup-plugin-jsdoc pnpm add rollup-plugin-jsdoc Imports
- jsdoc wrong
const jsdoc = require('rollup-plugin-jsdoc');correctimport jsdoc from 'rollup-plugin-jsdoc' - jsdoc wrong
const jsdoc = require('rollup-plugin-jsdoc');correctconst { default: jsdoc } = require('rollup-plugin-jsdoc'); - default wrong
import { jsdoc } from 'rollup-plugin-jsdoc'correctimport jsdoc from 'rollup-plugin-jsdoc'
Quickstart
// rollup.config.js
import jsdoc from 'rollup-plugin-jsdoc';
export default {
input: 'src/index.js',
output: {
file: 'dist/bundle.js',
format: 'cjs'
},
plugins: [
jsdoc({
args: ['-d', 'docs'],
config: 'jsdoc.config.json'
})
]
};