Registry / devops / webpack-blocks

webpack-blocks

JSON →
library2.1.0jsnpmunverified

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.

npm install webpack-blocks
INSTALL
IMPORT
SIG · WEBPACK-BLOCKS
W
webpack-blocks
devopsjavascriptv2.1.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createConfig
✓ import { createConfig } from 'webpack-blocks'
✗ const { createConfig } = require('webpack-blocks')
CJS require is supported; ESM import works with bundler. This is the main entry point.
babel
✓ import { babel } from 'webpack-blocks'
✗ import { babel6 } from 'webpack-blocks'
babel6 is deprecated; use babel block. babel block requires @babel/core and babel-loader as peer deps.
match
✓ import { match } from 'webpack-blocks'
✗ const match = require('@webpack-blocks/webpack').match
Direct require from subpackage is not public API; import from 'webpack-blocks'.
env
✓ import { env } from 'webpack-blocks'
✗ import { environment } from 'webpack-blocks'
The function is named env, not environment. It wraps blocks to apply conditionally based on NODE_ENV.

Demonstrates creating a webpack config with babel, CSS, PostCSS, extraction, uglify, and env-specific blocks using the convenience package.

const webpack = require('webpack'); const { babel, createConfig, css, defineConstants, entryPoint, env, extractText, match, setOutput, uglify, postcss } = require('webpack-blocks'); const cssnano = require('cssnano'); const config = createConfig([ entryPoint('./src/main.js'), setOutput('./build/bundle.js'), babel(), defineConstants({ 'process.env.NODE_ENV': process.env.NODE_ENV || 'development' }), match('*.css', { exclude: /node_modules/ }, [ css(), env('production', [ extractText(), postcss({ plugins: [cssnano()] }) ]) ]), env('production', [uglify()]) ]); module.exports = config;
Debug
Known issues
breakingMinimum Node.js version raised to Node 10 in v2.1.0
fix
Upgrade Node to >= 10
affects: >=2.1.0
deprecatedbabel6 block is deprecated; use @webpack-blocks/babel or babel from the convenience package
fix
Replace babel6 with babel block
affects: >=1.0.0
gotchapeer dependency on webpack — must be installed separately
fix
Install webpack: npm install --save-dev webpack webpack-blocks
affects: >=0.1.0
gotchaCSS loader does not exclude node_modules by default since v0.4.0; may cause unexpected behavior
fix
Explicitly exclude node_modules in match() or use exclude pattern
affects: >=0.4.0
Errors
Common errors & fixes
Cannot find module 'webpack-blocks'
Package not installed or not in node_modules
fix
npm install --save-dev webpack-blocks
TypeError: createConfig is not a function
Incorrect import or require path; missing default export
fix
Use destructured import: const { createConfig } = require('webpack-blocks')
Module not found: Error: Can't resolve 'babel-loader'
Missing peer dependency for babel block
fix
Install babel-loader: npm install --save-dev babel-loader @babel/core
Invalid configuration object. webpack has been initialised using a configuration object that does not match the API schema.
Wrong configuration structure from incompatible block version
fix
Ensure all @webpack-blocks/* packages are of same major version
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
webpackrequiredPeer dependency; webpack-blocks generates webpack configuration and requires webpack to be installed.
Agent activity
17 hits · last 30 days
node
14
Amazon
1
Resources
webpack-blocks — npm install webpack-blocks · libregistry