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-loaderVerified import paths — ran on the pinned version, not inferred.
Minimal webpack configuration to auto-format JavaScript files with Prettier using the loader.
Use exclude patterns or only apply to specific paths.
Upgrade to webpack 2+.
Use emitErrors or emitWarnings options to control behavior.
Rely on Prettier config files or pass options directly.
Run 'npm install prettier-loader prettier --save-dev'
Run 'npm install prettier --save-dev'
Check the options passed to the loader; they must match Prettier's API (e.g., 'semi' not 'semicolon').