Webpack To Rspack/Community Csminimizer To Rspack Plugin

1.0.1Last update Oct 29, 2024
by@dfordp

Change import and usage of from css-minimizer-webpack-plugin to use included rspack.LightningCssMinimizerRspackPlugin.

Before

//change the import statement to const rspack = require('@rspack/core');
//track where this CssMinimizerPlugin variable is used
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = {
optimization: {
//change CssMinimizerPlugin to rspack.LightningCssMinimizerRspackPlugin
minimizer: [new CssMinimizerPlugin()],
},
};

After

const rspack = require('@rspack/core');
module.exports = {
// ...
optimization: {
minimizer: [new rspack.LightningCssMinimizerRspackPlugin(options)],
},
};

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now