1.1.0 • Published 1 year ago

vite-plugin-replace-files v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

1.1.0

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago