trapcodeio/vite-plugin-ejs

How to create new param

4spen opened this issue · 3 comments

4spen commented

Hi, need some advice on how to create something like isProd? And how to rename isDev?

isDev was internally defined by the plugin and unfortunately cannot be renamed but you can add isProd or any other param you want like so.

import {defineConfig} from "vite";
import {ViteEjsPlugin} from "vite-plugin-ejs";

export default defineConfig({
  plugins: [
    ViteEjsPlugin((viteConfig) => {
      // viteConfig is the current viteResolved config.
      return {
        isProd: viteConfig.isProduction,
        someOtherParam: "value"
      }
    }),
  ],
});

The viteConfig variable has the options listed in https://vitejs.dev/config/#shared-options

Do let me know if this is what you meant by adding param.

Did this serve? @4spen

If no reply I would close this issue in the next 48 hrs.

4spen commented