Registry / devops / webpack-prettier-plugin

webpack-prettier-plugin

JSON →
library1.0.3jsnpmunverified

A webpack plugin that automatically reformats code (JavaScript, JSON, CSS, Sass) using Prettier during the build process. Version 1.0.3 is the latest, with an unknown release cadence. Its key differentiator is simplicity—three steps to integrate. However, it is a minimal wrapper around Prettier with limited documentation and no active development, making it less robust than alternatives like prettier-webpack-plugin.

npm install webpack-prettier-plugin
INSTALL
IMPORT
SIG · WEBPACK-PRETTIER-P
W
webpack-prettier-plugin
devopsjavascriptv1.0.3
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.

default
✓ const WebpackPrettierPlugin = require('webpack-prettier-plugin')
✗ import WebpackPrettierPlugin from 'webpack-prettier-plugin'
Package does not export ESM; use CommonJS require().
WebpackPrettierPlugin
✓ const WebpackPrettierPlugin = require('webpack-prettier-plugin')
✗ const { WebpackPrettierPlugin } = require('webpack-prettier-plugin')
Default export is the plugin class, not named.
PrettierPlugin
✓ new (require('webpack-prettier-plugin'))()
✗ new require('webpack-prettier-plugin').PrettierPlugin()
Misleading alias; the constructor is the default export.

Demonstrates registration of the plugin in webpack.config.js using CommonJS require() and instantiation.

// webpack.config.js const WebpackPrettierPlugin = require('webpack-prettier-plugin'); module.exports = { // ... other config plugins: [ new WebpackPrettierPlugin() ] };
Debug
Known issues
gotchaPlugin does not support ESM import syntax. Must use require().
fix
Use const WebpackPrettierPlugin = require('webpack-prettier-plugin') instead of import.
affects: <=1.0.3
gotchaThe plugin name in the README example uses PrettierPlugin but the actual export is WebpackPrettierPlugin.
fix
Use const WebpackPrettierPlugin = require('webpack-prettier-plugin'); new WebpackPrettierPlugin()
affects: <=1.0.3
gotchaNo explicit error if prettier is not installed; may fail silently.
fix
Ensure prettier is installed as a devDependency: npm install --save-dev prettier
affects: <=1.0.3
Errors
Common errors & fixes
Cannot find module 'webpack-prettier-plugin'
Package not installed or misspelled
fix
npm install --save-dev webpack-prettier-plugin
TypeError: WebpackPrettierPlugin is not a constructor
Using named import instead of default require()
fix
Use const WebpackPrettierPlugin = require('webpack-prettier-plugin'); new WebpackPrettierPlugin()
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
prettierrequiredpeer dependency; required for actual formatting
Agent activity
6 hits · last 30 days
node
6
Resources
webpack-prettier-plugin — npm install webpack-prettier-plugin · libregistry