A webpack loader that uses the preprocess library to conditionally include or exclude code in HTML, JavaScript, CoffeeScript, and other module files based on custom or environment configurations. Version 0.3.0 is the latest stable release (the project appears inactive since 2017). It supports Webpack 1 and 2+ and allows overriding preprocess options via the `ppOptions` query parameter. Similar to gulp-preprocess, it provides directive syntax for conditional compilation (@if, @ifdef, @echo, @include). The loader is typically placed before other loaders in a chain to preprocess files before they are transpiled.
npm install preprocess-loaderVerified import paths — ran on the pinned version, not inferred.
Webpack 2+ configuration using preprocess-loader with environment variables and Babel.
Place preprocess-loader earlier in the `use` array (right-to-left execution).
Chain two preprocess loaders: one with type:'cjsx' before CoffeeScript loader, one with type:'js' after.
Use `rules` with `use` array and `options` object.
Check preprocess v3 release notes for breaking changes; update your code if necessary.
Run `npm install preprocess-loader --save-dev` or `yarn add preprocess-loader --dev`.
Replace `module.loaders` with `module.rules` and `loader` with `use`.
Add preprocess-loader to the `use` array before other loaders (e.g., before babel-loader).