{"id":20711,"library":"webpack-blocks","title":"webpack-blocks - Convenience package for webpack configuration blocks","description":"webpack-blocks (v2.1.0) is a higher-level abstraction for building webpack configurations using composable 'blocks' instead of raw config objects. It bundles the most common blocks (babel, css, sass, typescript, uglify, etc.) so you only need one dependency. Designed to simplify webpack config, it follows a functional composition pattern. Release cadence is low (last release 2019). Key differentiator: declarative, composable config vs imperative webpack config. Requires Node >= 10. Alternative to webpack-chain or direct webpack config. Currently in maintenance mode.","status":"maintenance","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/andywer/webpack-blocks","tags":["javascript","webpack","webpack-blocks"],"install":[{"cmd":"npm install webpack-blocks","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-blocks","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-blocks","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; webpack-blocks generates webpack configuration and requires webpack to be installed.","package":"webpack","optional":false}],"imports":[{"note":"CJS require is supported; ESM import works with bundler. This is the main entry point.","wrong":"const { createConfig } = require('webpack-blocks')","symbol":"createConfig","correct":"import { createConfig } from 'webpack-blocks'"},{"note":"babel6 is deprecated; use babel block. babel block requires @babel/core and babel-loader as peer deps.","wrong":"import { babel6 } from 'webpack-blocks'","symbol":"babel","correct":"import { babel } from 'webpack-blocks'"},{"note":"Direct require from subpackage is not public API; import from 'webpack-blocks'.","wrong":"const match = require('@webpack-blocks/webpack').match","symbol":"match","correct":"import { match } from 'webpack-blocks'"},{"note":"The function is named env, not environment. It wraps blocks to apply conditionally based on NODE_ENV.","wrong":"import { environment } from 'webpack-blocks'","symbol":"env","correct":"import { env } from 'webpack-blocks'"}],"quickstart":{"code":"const webpack = require('webpack');\nconst { babel, createConfig, css, defineConstants, entryPoint, env, extractText, match, setOutput, uglify, postcss } = require('webpack-blocks');\nconst cssnano = require('cssnano');\n\nconst config = createConfig([\n  entryPoint('./src/main.js'),\n  setOutput('./build/bundle.js'),\n  babel(),\n  defineConstants({\n    'process.env.NODE_ENV': process.env.NODE_ENV || 'development'\n  }),\n  match('*.css', { exclude: /node_modules/ }, [\n    css(),\n    env('production', [\n      extractText(),\n      postcss({ plugins: [cssnano()] })\n    ])\n  ]),\n  env('production', [uglify()])\n]);\n\nmodule.exports = config;","lang":"javascript","description":"Demonstrates creating a webpack config with babel, CSS, PostCSS, extraction, uglify, and env-specific blocks using the convenience package."},"warnings":[{"fix":"Upgrade Node to >= 10","message":"Minimum Node.js version raised to Node 10 in v2.1.0","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Replace babel6 with babel block","message":"babel6 block is deprecated; use @webpack-blocks/babel or babel from the convenience package","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Install webpack: npm install --save-dev webpack webpack-blocks","message":"peer dependency on webpack — must be installed separately","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Explicitly exclude node_modules in match() or use exclude pattern","message":"CSS loader does not exclude node_modules by default since v0.4.0; may cause unexpected behavior","severity":"gotcha","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev webpack-blocks","cause":"Package not installed or not in node_modules","error":"Cannot find module 'webpack-blocks'"},{"fix":"Use destructured import: const { createConfig } = require('webpack-blocks')","cause":"Incorrect import or require path; missing default export","error":"TypeError: createConfig is not a function"},{"fix":"Install babel-loader: npm install --save-dev babel-loader @babel/core","cause":"Missing peer dependency for babel block","error":"Module not found: Error: Can't resolve 'babel-loader'"},{"fix":"Ensure all @webpack-blocks/* packages are of same major version","cause":"Wrong configuration structure from incompatible block version","error":"Invalid configuration object. webpack has been initialised using a configuration object that does not match the API schema."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}