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

1.4.6 • Public • Published

vite-plugin-replace

Replace a string with another string in all code files. Primary needed for the entry-point index.html file.

Usage

// vite.config.ts
// eslint-disable-next-line import/no-extraneous-dependencies, node/no-extraneous-import, import/no-unresolved, node/no-missing-import
import replace from "@lpgroup/vite-plugin-replace";

const replaceArr = [
  { src: "http://localhost:8189/harper-0.0.1.umd.js", production: "/harper/harper-0.0.1.umd.js" },
];

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  return {
    plugins: [
      // ...otherplugins
      replace(replaceArr, mode),
    ],
  };
});

Options

{
  /**
   * array of object with key/value replace
   */
   replace: array
   /**
    * production or development mode, can get this from vite.
    * @default 'development'
    */
   mode: string
}

Package Sidebar

Install

npm i @lpgroup/vite-plugin-replace

Weekly Downloads

21

Version

1.4.6

License

MIT

Unpacked Size

5.03 kB

Total Files

8

Last publish

Collaborators

  • arlukin
  • muscot