vite-plugin-replace-files
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

vite-plugin-replace-files

Replace files during Vite build - handy when replacing strings is not enough.

Install

Install with your favorite package manager (e.g. npm):

npm install -D vite-plugin-replace-files

Usage

This plugin should go before any other stuff in plugins array, so all other plugins that runs later could e.g. apply optimisations.

Add to vite.config.ts - example below will replace file src/env.ts with file conf/env.ts:

import { defineConfig } from 'vite';
import path from 'path';
import replaceFiles from 'vite-plugin-replace-files';

export default defineConfig({
  plugins: [
    replaceFiles([
      {
        file: path.join('src', 'env.ts'),
        replacement: path.join('conf', 'env.ts'),
      },
    ])
  ],
});

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i vite-plugin-replace-files

Weekly Downloads

81

Version

1.1.0

License

MIT

Unpacked Size

6.85 kB

Total Files

8

Last publish

Collaborators

  • elwin013