jsdoc-webpack-plugin
raw JSON → 0.3.0 verified Sat Apr 25 auth: no javascript maintenance
Webpack plugin that runs JSDoc on your bundles, version 0.3.0. Low activity; last release 2016. Generates documentation from webpack bundle files, optionally using JSDoc config or bundle sources. Minimal features: conf path, CWD, preserve temp file, recursive flag. Less maintained than alternatives like 'jsdoc-webpack-plugin' or 'webpack-jsdoc'. Not suitable for modern webpack 5+ without potential compatibility issues.
Common errors
error TypeError: JsDocPlugin is not a constructor ↓
cause Using named import instead of default: const { JsDocPlugin } = require('jsdoc-webpack-plugin');
fix
Use correct require: const JsDocPlugin = require('jsdoc-webpack-plugin');
error Error: Cannot find module 'jsdoc' ↓
cause jsdoc is not installed (not a package dependency, only peer).
fix
Install jsdoc: npm install --save-dev jsdoc
error WebpackOptionsValidationError: Invalid configuration object ↓
cause Plugin options passed incorrectly or webpack version incompatible.
fix
Ensure plugin is instantiated correctly: new JsDocPlugin({ conf: '...' }) and webpack version <= 3.
Warnings
breaking Plugin uses webpack 1 plugin API internally; incompatible with webpack 4/5 without modification. ↓
fix Use a maintained plugin like 'webpack-jsdoc' or 'jsdoc-webpack-plugin-v4'.
deprecated Package has no updates since 2016; dependencies (jsdoc) may have breaking changes. ↓
fix Pin jsdoc version to known compatible range or migrate to a maintained plugin.
gotcha Option 'conf' expects a file path without .json extension? Documentation unclear; actual behavior may differ. ↓
fix Experiment with 'jsdoc.conf', 'jsdoc.conf.json', or absolute path.
gotcha Plugin creates temporary files; may leave artifacts if preserveTmpFile false and jsdoc crashes. ↓
fix Set preserveTmpFile: true during development, clean manually if needed.
Install
npm install jsdoc-webpack-plugin yarn add jsdoc-webpack-plugin pnpm add jsdoc-webpack-plugin Imports
- JsDocPlugin (default) wrong
const { JsDocPlugin } = require('jsdoc-webpack-plugin');correctconst JsDocPlugin = require('jsdoc-webpack-plugin'); - JsDocPlugin (ESM) wrong
import { JsDocPlugin } from 'jsdoc-webpack-plugin';correctimport JsDocPlugin from 'jsdoc-webpack-plugin'; - Plugin instantiation wrong
new JsDocPlugin.JsDocPlugin({ conf: 'jsdoc.conf.json' })correctnew JsDocPlugin({ conf: 'jsdoc.conf.json' })
Quickstart
const JsDocPlugin = require('jsdoc-webpack-plugin');
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [
new JsDocPlugin({
conf: 'jsdoc.conf',
cwd: '.',
preserveTmpFile: false,
recursive: false
})
]
};