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
muslnode 18–226 runs
build_error
glibcnode 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;
Errors
Common errors & fixes
Cannot find module 'webpack-blocks'
Package not installed or not in node_modules
fixnpm install --save-dev webpack-blocks
TypeError: createConfig is not a function
Incorrect import or require path; missing default export
fixUse destructured import: const { createConfig } = require('webpack-blocks') Module not found: Error: Can't resolve 'babel-loader'
Missing peer dependency for babel block
fixInstall 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
fixEnsure all @webpack-blocks/* packages are of same major version
Audit
Dependencies
webpackrequiredPeer dependency; webpack-blocks generates webpack configuration and requires webpack to be installed.