Registry / devops / prettier-loader

prettier-loader

JSON →
library3.3.0jsnpmunverified

Webpack loader that auto-formats source code with Prettier during the build process. Current stable version is 3.3.0, with ongoing maintenance. It integrates seamlessly with webpack-dev-server to format on every save, supporting Prettier configuration files and ignore directives. Unlike pre-commit hooks or CLI scripts, this loader ensures consistent formatting without additional watchers or developer setup. Requires webpack >= 2 and prettier >= 1.6.

npm install prettier-loader
INSTALL
IMPORT
SIG · PRETTIER-LOADER
P
prettier-loader
devopsjavascriptv3.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

prettier-loader
import PrettierLoader from 'prettier-loader'
import { prettier-loader } from 'prettier-loader'
Loader is used in webpack config, not typically imported directly. Common mistake is using named import.
use in webpack config
use: { loader: 'prettier-loader', options: {...} }
use: 'prettier-loader' without options
Loader must be referenced as string in webpack rules.
loader in Rule
module.exports = { module: { rules: [ { test: /\.jsx?$/, use: { loader: 'prettier-loader' } } ] } }
require('prettier-loader') in config
Loader is resolved by webpack; not required directly.

Minimal webpack configuration to auto-format JavaScript files with Prettier using the loader.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.jsx?$/, use: { loader: 'prettier-loader', options: { parser: 'babel', semi: true, singleQuote: true } }, exclude: /node_modules/ } ] } };
Debug
Known issues
gotchaLoader may slow down build on large codebases due to formatting overhead.
fix
Use exclude patterns or only apply to specific paths.
affects: >=1.0.0
breakingWebpack 1 is not supported; version requirement changed from webpack >= 2 to webpack >= 2 (always been).
fix
Upgrade to webpack 2+.
affects: >=1.0.0
gotchaLoader runs on every file match; if prettier fails, the build may break.
fix
Use emitErrors or emitWarnings options to control behavior.
affects: >=1.0.0
deprecatedOptions like 'configFile' may be deprecated in favor of Prettier's own config resolution.
fix
Rely on Prettier config files or pass options directly.
affects: >=3.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'prettier-loader'
Missing installation of prettier-loader or prettier peer dependency.
fix
Run 'npm install prettier-loader prettier --save-dev'
Error: Cannot find module 'prettier'
Prettier peer dependency not installed.
fix
Run 'npm install prettier --save-dev'
ValidationError: Invalid options object. Prettier Loader has been initialized using an options object that does not match the API schema.
Invalid option name or type passed to loader options.
fix
Check the options passed to the loader; they must match Prettier's API (e.g., 'semi' not 'semicolon').
Upgrade
Version history
3.3.0latest on npm
Audit
Dependencies
prettierrequiredpeer dependency - the formatting engine
webpackrequiredpeer dependency - the bundler
Agent activity
8 hits · last 30 days
node
8
Resources
prettier-loader — npm install prettier-loader · libregistry