Skip to main content
PRONeed enterprise-grade codemods tailored to your codebase?

Assess, plan, evolve.

Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.

23 packages

Sort by
webpack/v5/migration-recipe

This recipe is a set of codemods that will help migrate webpack v4 to v5. The recipe includes the following codemods: - webpack/v5/migrate-library-target-to-library-object - webpack/v5/json-imports-to-default-imports - webpack/v5/set-target-to-false-and-update-plugins

  • webpack
  • migration
  • +1
Aakash-kumar-dev
v1.0.1
455
a year ago
webpack/css-plugins-to-native-css

Migrate CSS plugins, loaders, and supported css-minimizer-webpack-plugin options to webpack's native CSS support and minification

  • transformation
  • migration
  • +1
Wwebpack avatarwebpack
v1.0.1
89
11 days ago
webpack/v5/json-imports-to-default-imports

This codemod migrates imports from JSON modules that use named exports to use default exports instead. This codemod transforms named imports from JSON files into default imports, adhering to the new ECMAScript specification and Webpack v5 compatibility. Named imports from JSON modules are no longer supported. ## Example ### Before ```ts import { version } from "./package.json"; console.log(version); ``` ### After ```ts import pkg from "./package.json"; console.log(pkg.version); ``` , ### Before ```ts import { version, name, description } from "./package.json"; console.log(version, name, description); ``` ### After ```ts import pkg from "./package.json"; console.log(pkg.version, pkg.name, pkg.description); ``` , ### Before ```ts import { data } from './config.json'; console.log(data.nested.key, data.anotherKey); ``` ### After ```ts import config from './config.json'; console.log(config.data.nested.key, config.data.anotherKey); ``` , ### Before ```ts import { key1, key2 } from './config.json'; console.log(key1, key2); ``` ### After ```ts import config from './config.json'; console.log(config.key1, config.key2); ```

  • webpack
  • migration
  • +1
Aakash-kumar-dev
v1.0.4
7,918
a year ago
webpack/html-plugins-to-native-html

Migrate html-webpack-plugin and html-loader to webpack's native HTML support and minification

  • transformation
  • migration
  • +1
Wwebpack avatarwebpack
v1.0.0
1
16 days ago
webpack/v5/set-target-to-false-and-update-plugins

This codemod migrates the `target` property in Webpack configurations from a function to `false` and moves the function to the `plugins` array. In Webpack 4, it was possible to set the `target` property to a function. However, in Webpack 5, this approach is no longer supported. Instead, the `target` should be set to `false`, and the function should be included in the `plugins` array. This codemod automates the transformation of Webpack configurations to adhere to the new specification. ## Example ### Before ```ts module.exports = { target: WebExtensionTarget(nodeConfig), }; ``` ### After ```ts module.exports = { target: false, plugins: [WebExtensionTarget(nodeConfig)], }; ``` , ### Before ```ts const WebExtensionTarget = require("webpack-extension-target"); module.exports = { target: WebExtensionTarget(nodeConfig), mode: "development", output: { filename: "bundle.js", }, }; ``` ### After ```ts const WebExtensionTarget = require("webpack-extension-target"); module.exports = { target: false, plugins: [WebExtensionTarget(nodeConfig)], mode: "development", output: { filename: "bundle.js", }, }; ``` , ### Before ```ts module.exports = { target: WebExtensionTarget(nodeConfig), optimization: { splitChunks: { chunks: "all", }, }, }; ``` ### After ```ts module.exports = { target: false, plugins: [WebExtensionTarget(nodeConfig)], optimization: { splitChunks: { chunks: "all", }, }, }; ``` , ### Before ```ts module.exports = { target: CustomTargetFunction(config), }; ``` ### After ```ts module.exports = { target: false, plugins: [CustomTargetFunction(config)], }; ```

  • webpack
  • migration
  • +1
Aakash-kumar-dev
v1.0.1
974
a year ago
webpack/v5/migrate-library-target-to-library-object

This codemod migrates the `output.library` and `output.libraryTarget` properties in Webpack configurations to the new format required by Webpack 5. It changes `output.library` to `output.library.name` and `output.libraryTarget` to `output.library.type`. ## Example ### Before ```ts module.exports = { output: { library: "MyLibrary", libraryTarget: "commonjs2", }, }; ``` ### After ```ts module.exports = { output: { library: { name: "MyLibrary", type: "commonjs2", }, }, }; ``` , ### Before ```ts module.exports = { output: { library: "MyLibrary", libraryTarget: "commonjs2", filename: "bundle.js", }, }; ``` ### After ```ts module.exports = { output: { library: { name: "MyLibrary", type: "commonjs2", }, filename: "bundle.js", }, }; ``` , ### Before ```ts module.exports = { output: { library: "MyLibrary", }, }; ``` ### After ```ts module.exports = { output: { library: { name: "MyLibrary", type: undefined, }, }, }; ``` , ### Before ```ts module.exports = { output: { library: "MyLibrary", libraryTarget: "umd", path: "./dist", }, }; ``` ### After ```ts module.exports = { output: { library: { name: "MyLibrary", type: "umd", }, path: "./dist", }, }; ```

  • webpack
  • migration
  • +1
Aakash-kumar-dev
v1.0.1
8,121
a year ago
webpack-to-rspack/migration-recipe

This recipe is a set of codemods that will help migrate from webpack to rspack. The recipe includes the following codemods: - webpack-to-rspack/handling-built-in-plugins-migrations - webpack-to-rspack/copywebpackplugin-community-to-included-plugin - webpack-to-rspack/remove_tsconfigpathsplugin-paths-plugin - webpack-to-rspack/migrate-update-babel-loader-to-swc-loader - webpack-to-rspack/remove-file-loader-to-type-asset-resource - webpack-to-rspack/remove-url-loader-to-type-asset-inline - webpack-to-rspack/remove-raw-loader-to-type-asset-source - webpack-to-rspack/cssextractwebpackplugin-community-to-included-plugin - webpack-to-rspack/eslint-webpack-plugin-to-eslint-rspack-plugin - webpack-to-rspack/migrate-manifest-plugin - webpack-to-rspack/replace-webpack-virtual-modules-to-rspack-plugin-virtual-module - webpack-to-rspack/replace-workbox-webpack-plugin-to-aaroon/workbox-rspack-plugin - webpack-to-rspack/community-csminimizer-to-rspack-plugin - webpack-to-rspack/migrate-html-plugin - webpack-to-rspack/migrate-terser-plugin

  • vue
  • radix
  • +1
Ddfordp
v1.0.3
2
2 years ago
webpack-to-rspack/handling-built-in-plugins-migrations

- Rspack has implemented most of webpack's built-in plugins, with the same names and configuration parameters, allowing for easy replacement. - Replace the the include package from webpack to rspack one. - Replaces the webpack object in the plugins array to rspack object. - Handles only for supported and partially supported built-in plugins. (as of 11th Oct 2024) ### Before ```ts //replace the the include package from webpack to rspack one // and the webpack object in the plugins array to rspack object const webpack = require('webpack'); module.exports = { //... plugins: [ new webpack.DefinePlugin(), // ... ], }; ``` ### After ```ts const rspack = require('@rspack/core'); module.exports = { //... plugins: [ new rspack.DefinePlugin({ // ... }), ], }; ```

  • webpack
  • version 5
  • +3
Ddfordp
v1.0.0
489
2 years ago
webpack-to-rspack/eslint-webpack-plugin-to-eslint-rspack-plugin

Change import from eslint-webpack-plugin to eslint-rspack-plugin. ### Before ```ts //change the import package from eslint-webpack-plugin to eslint-rspack-plugin const ESLintPlugin = require('eslint-webpack-plugin'); module.exports = { // ... plugins: [new ESLintPlugin(options)], // ... }; ``` ### After ```ts const ESLintPlugin = require('eslint-rspack-plugin'); module.exports = { // ... plugins: [new ESLintPlugin(options)], // ... }; ```

  • webpack
  • version 5
  • +4
Ddfordp
v1.0.1
480
2 years ago
webpack-to-rspack/migrate-html-plugin

Change import and usage of from html-webpack-tags-plugin to use includedhtml-rspack-tags-plugin. ### Before ```ts //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 ```ts 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 }), ], }; ```

  • webpack
  • version 5
  • +4
Ddfordp
v1.0.0
73
2 years ago
webpack-to-rspack/migrate-terser-plugin

Change import and usage of from TerserPlugin to use included rspack.SwcJsMinimizerRspackPlugin. ### Before ```ts //chnage the import statement to const rspack = require('@rspack/core'); //track the variable assigned const TerserPlugin = require('terser-webpack-plugin'); module.exports = { optimization: { //change to rspack.SwcJsMinimizerRspackPlugin(options) minimizer: [new TerserPlugin(options)], }, }; ``` ### After ```ts const rspack = require('@rspack/core'); module.exports = { // ... optimization: { minimizer: [new rspack.SwcJsMinimizerRspackPlugin(options)], }, }; ```

  • webpack
  • version 5
  • +4
Ddfordp
v1.0.0
4
2 years ago
webpack-to-rspack/migrate-manifest-plugin

Change import from webpack-manifest-plugin torspack-manifest-plugin. ### Before ```ts //change the import from webpack-manifest-plugin to rspack-manifest-plugin const { WebpackManifestPlugin } = require('webpack-manifest-plugin'); module.exports = { plugins: [new WebpackManifestPlugin(options)], }; ``` ### After ```ts const { RspackManifestPlugin } = require('rspack-manifest-plugin'); module.exports = { plugins: [new RspackManifestPlugin(options)], }; ```

  • webpack
  • version 5
  • +4
Ddfordp
v1.0.2
472
2 years ago

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.