Registry /
web-framework / webpack-theme-color-replacer
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–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ThemeColorReplacer
✓ const ThemeColorReplacer = require('webpack-theme-color-replacer');
✗ import ThemeColorReplacer from 'webpack-theme-color-replacer';
CommonJS export; ESM import fails due to missing default export.
client
✓ const client = require('webpack-theme-color-replacer/client');
✗ import { client } from 'webpack-theme-color-replacer';
Client-side runtime file must be required separately.
ThemeColorReplacer
✓ const ThemeColorReplacer = require('webpack-theme-color-replacer').default;
Alternative CommonJS syntax if using TypeScript with esModuleInterop.
Configures the webpack plugin to replace primary color '#1890ff' at runtime and demonstrates client-side color change.
// webpack.config.js
const ThemeColorReplacer = require('webpack-theme-color-replacer');
module.exports = {
plugins: [
new ThemeColorReplacer({
matchColors: ['#1890ff'], // primary color
fileName: 'css/theme-colors-[hash].css',
externalCssFiles: [],
changeSelector: async (colors) => colors.map(color => `.${color}`),
injectCss: true,
isJsOutput: true,
resolve: {},
})
]
};
// In client code (e.g., src/index.js)
const client = require('webpack-theme-color-replacer/client');
client.changer.changeColor({ oldColor: '#1890ff', newColor: '#f5222d' });
Errors
Common errors & fixes
Error: Cannot find module 'webpack-theme-color-replacer/client'
Client module not required correctly; path may be incorrect.
fixUse require('webpack-theme-color-replacer/client') with correct relative path. TypeError: client.changer.changeColor is not a function
Using old API from pre-1.4 versions.
fixUpdate to v1.4+ and use client.changer.changeColor({oldColor, newColor}). Colors not being replaced at runtime
CSS not extracted or matchColors are not in lowercase hex.
fixEnsure MiniCssExtractPlugin is used and colors are lowercase hex without alpha.
Audit
Dependencies
webpackrequiredPlugin requires webpack as peer dependency to hook into compilation