Webpack To Rspack/Migrate Html Plugin

1.0.0Last update Oct 17, 2024
by@dfordp

Change import and usage of from html-webpack-tags-plugin to use includedhtml-rspack-tags-plugin.

Before

//change to const HtmlRspackTagsPlugin = require('html-rspack-tags-plugin');
const HtmlWebpackTagsPlugin = require('html-webpack-tags-plugin');
//change to const rspack = require('@rspack/core');
const HtmlWebpackPlugin = require('html-webpack-plugin');
//track the variables assigned in the import statements
module.exports = {
plugins: [
//change to new rspack.HtmlRspackPlugin(),
new HtmlWebpackPlugin(),
//chnage to HtmlRspackTagsPlugin
new HtmlWebpackTagsPlugin({ tags: ['a.js', 'b.css'], append: true }),
],
};

After

const HtmlRspackTagsPlugin = require('html-rspack-tags-plugin');
const rspack = require('@rspack/core');
module.exports = {
plugins: [
new rspack.HtmlRspackPlugin(),
new HtmlRspackTagsPlugin({ tags: ['a.js', 'b.css'], append: true }),
],
};

Build custom codemods

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

background illustrationGet Started Now