Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vite-plugin-replace

leanupjs70.7kMIT0.1.1TypeScript support: included

With this plugin text in sourcecode could be replaced before bundling.

vite, plugin, replace

readme

Vite Plugin Replace

With this plugin text in sourcecode could be replaced before bundling.

Installation

npm i -D vite-plugin-replace

Usage

import packageJson from "./package.json";
import { replaceCodePlugin } from "vite-plugin-replace";

module.exports = mergeConfig(config, {
  plugins: [
    replaceCodePlugin({
      replacements: [
        {
          from: "__CLI_NAME__",
          to: packageJson.name,
        },
        {
          from: /__CLI_VERSION__/g,
          to: packageJson.version,
        },
      ],
    }),
  ],
});