An unplugin to apply e18e-recommended modernization and performance replacements.
Warning
This plugin is experimental and not yet published publicly. Use at your own risk.
This plugin automatically transforms your code at build time to use modern web platform features, improving performance and reducing bundle size.
Example:
// before
const lastItem = array[array.length - 1];
// after: modern Array#at() method
const lastItem = array.at(-1);npm install @e18e/unplugin-replacements --save-devimport { defineConfig } from 'vite'
import replacements from '@e18e/unplugin-replacements/vite'
export default defineConfig({
plugins: [
replacements({
// plugin options
})
]
})Type: Array<string>
Specify which codemods to include. When provided, only the listed transformations will be applied.
replacements({
include: ['arrayAt', 'objectHasOwn']
})Type: Array<string>
Specify which codemods to exclude. All transformations will be applied except those listed.
replacements({
exclude: ['arrayAt']
})Note
Available codemod names come from @e18e/web-features-codemods.
- @e18e/eslint-plugin - ESLint plugin suggesting and autofixing modernizations and performance improvements.
- @e18e/web-features-codemods - Collection of codemods used to migrate codebases to modern web platform features.
- @e18e/cli - CLI tool to run the codemods interactively on your codebase and analyze your project for other performance opportunities.
- @e18e/mcp - MCP server which advises agents on modernizations and performance improvements.
- module-replacements - A community maintained data set of modern module replacements.
MIT