Registry / testing / rsbuild-plugin-publint

rsbuild-plugin-publint

JSON →
library0.3.4jsnpmunverified

Rsbuild plugin that runs publint to lint npm packages after the build process. It helps library authors catch compatibility issues early by validating package exports, detecting incorrect module formats, and ensuring proper CJS/ESM interop. Version 0.3.4 is the current stable release; maintained actively with frequent updates. Key differentiators: seamless integration with Rsbuild/Rslib, configurable severity thresholds via throwOn option, and ability to run conditionally with enable option. Unlike manual publint invocation, this runs automatically on each build, preventing publishing broken packages.

npm install rsbuild-plugin-publint
INSTALL
IMPORT
SIG · RSBUILD-PLUGIN-PUB
R
rsbuild-plugin-publint
testingjavascriptv0.3.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pluginPublint
import { pluginPublint } from 'rsbuild-plugin-publint'
import pluginPublint from 'rsbuild-plugin-publint'
Named export only; default import is not available.
pluginPublint
const { pluginPublint } = require('rsbuild-plugin-publint')
const pluginPublint = require('rsbuild-plugin-publint')
CommonJS requires destructured require; package exports both CJS and ESM.
pluginPublint
export default { plugins: [pluginPublint()] }
export default { plugins: [pluginPublint] }
pluginPublint is a function that returns a plugin object, not a plugin object itself. Must be called.

Demonstrates basic usage with CI-only enable and strict error handling.

import { defineConfig } from '@rsbuild/core'; import { pluginPublint } from 'rsbuild-plugin-publint'; export default defineConfig({ plugins: [pluginPublint({ enable: Boolean(process.env.CI ?? false), throwOn: 'error', publintOptions: { level: 'error', }, })], });
Debug
Known issues
gotchapluginPublint() must be called; passing the function reference without parentheses will not register the plugin.
fix
Use pluginPublint() with parentheses.
affects: >=0.0.1
gotchaIn watch mode, errors are printed instead of thrown, even if throwOn is set to 'error'.
fix
Do not rely on throw behavior in watch mode; check console output.
affects: >=0.2.1
deprecatedThe level option in publintOptions may be deprecated in future publint versions; prefer using throwOn for severity control.
fix
Use throwOn instead of setting level in publintOptions.
affects: >=0.2.0 <0.3.0
breakingIn v0.3.0, pluginPublint changed from running on every build to only on first build to improve watch mode. If you relied on it running every time, update your workflow.
fix
Upgrade to >=0.3.1 which restored per-build behavior for non-watch.
affects: 0.3.0
Errors
Common errors & fixes
TypeError: pluginPublint is not a function
Using default import instead of named import.
fix
Change import to: import { pluginPublint } from 'rsbuild-plugin-publint'
Error: Cannot find module 'rsbuild-plugin-publint'
Package not installed or missing from node_modules.
fix
Run: npm install rsbuild-plugin-publint -D
Error: Expected options to be an object, got undefined
Passing nothing to pluginPublint() is allowed, but if you pass undefined explicitly, it may error. Also if you call pluginPublint without parentheses.
fix
Call pluginPublint() with or without options object, e.g., pluginPublint() or pluginPublint({})
Error: publint failed with errors
publint found errors in the built package.
fix
Check publint output for details; you can set throwOn to 'never' to avoid build failure.
Upgrade
Version history
0.3.4latest on npm
Audit
Dependencies
@rsbuild/corerequiredpeer dependency required to register the plugin
Agent activity
4 hits · last 30 days
node
4
Resources
rsbuild-plugin-publint — npm install rsbuild-plugin-publint · libregistry