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

    1.3.89 • 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
    }

    Install

    npm i @lpgroup/vite-plugin-replace

    DownloadsWeekly Downloads

    70

    Version

    1.3.89

    License

    MIT

    Unpacked Size

    7.07 kB

    Total Files

    6

    Last publish

    Collaborators

    • arlukin
    • muscot