A webpack loader that strips or keeps code blocks based on preprocessor directives like `#if`, `#elif`, `#else`, `#endif`, supporting JavaScript and HTML files. It uses a declarative syntax similar to C preprocessor. Version 0.1.12 is the latest, but the project appears unmaintained (last commit years ago). Key differentiators: simple condition syntax, supports nested logic, and works with webpack 1/2 loaders. Alternatives like preprocess-loader or webpack-strip-block may be more modern.
npm install webpack-preprocessorVerified import paths — ran on the pinned version, not inferred.
Set up webpack loader config and use preprocessor directives in JS files to conditionally include code based on definitions.
Use a modern loader like preprocess-loader or write inline loaders.
Use nested conditions or chain multiple #if directives.
Pass definitions as valid JSON array: definitions='["dev","stage"]'
Consider migrating to an actively maintained alternative.
Run `npm install webpack-preprocessor --save-dev`.
Use `?definitions='["dev"]'` or use options object with webpack 4+.