{"library":"preprocess-loader","title":"Preprocess Loader","description":"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.","language":"javascript","status":"maintenance","last_verified":"Sat Apr 25","install":{"commands":["npm install preprocess-loader"],"cli":null},"imports":["import PreprocessLoader from 'preprocess-loader'","module.exports = { module: { rules: [ { test: /\\.js$/, use: 'preprocess-loader?+DEBUG' } ] } }","use: [ { loader: 'preprocess-loader', options: { DEBUG: true, NODE_ENV: 'production' } } ]"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        use: [\n          {\n            loader: 'preprocess-loader',\n            options: {\n              DEBUG: process.env.DEBUG === 'true' ? true : false,\n              NODE_ENV: process.env.NODE_ENV ?? 'production'\n            }\n          },\n          'babel-loader'\n        ]\n      }\n    ]\n  }\n};\n\n// In your source.js\nconst configValue = '/* @echo FOO */' || 'default value';\n\n// @ifdef DEBUG\nconsole.log('Debugging enabled');\n// @endif","lang":"javascript","description":"Webpack 2+ configuration using preprocess-loader with environment variables and Babel.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}