webpack-prettier-plugin

raw JSON →
1.0.3 verified Sat Apr 25 auth: no javascript maintenance

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.

error Cannot find module 'webpack-prettier-plugin'
cause Package not installed or misspelled
fix
npm install --save-dev webpack-prettier-plugin
error TypeError: WebpackPrettierPlugin is not a constructor
cause Using named import instead of default require()
fix
Use const WebpackPrettierPlugin = require('webpack-prettier-plugin'); new WebpackPrettierPlugin()
gotcha Plugin does not support ESM import syntax. Must use require().
fix Use const WebpackPrettierPlugin = require('webpack-prettier-plugin') instead of import.
gotcha The plugin name in the README example uses PrettierPlugin but the actual export is WebpackPrettierPlugin.
fix Use const WebpackPrettierPlugin = require('webpack-prettier-plugin'); new WebpackPrettierPlugin()
gotcha No explicit error if prettier is not installed; may fail silently.
fix Ensure prettier is installed as a devDependency: npm install --save-dev prettier
npm install webpack-prettier-plugin
yarn add webpack-prettier-plugin
pnpm add webpack-prettier-plugin

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()
  ]
};