moving-leads-form / src / admin / vite / vite.config.js
vite.config.js
Raw
import svelte from "@sveltejs/vite-plugin-svelte";
import liveReload from "vite-plugin-live-reload";
const { resolve } = require("path");

export default {
  plugins: [
    svelte(),
    liveReload(__dirname + "/../*.php"),
    // edit according to your source code
  ],

  // config
  root: "src",
  base: process.env.APP_ENV === "development" ? "/" : "/dist/",

  build: {
    // output dir for production build
    outDir: resolve(__dirname, "../dist"),
    emptyOutDir: true,

    // emit manifest so PHP can find the hashed files
    manifest: true,

    // esbuild target
    target: "es2018",

    // our entry
    rollupOptions: {
      input: "/main.js",
    },
  },

  server: {
    // required to load scripts from custom host
    cors: true,

    // we need a strict port to match on PHP side
    // change freely, but update on PHP to match the same port
    strictPort: true,
    port: 3000,
  },

  // required for in-browser template compilation
  // https://v3.vuejs.org/guide/installation.html#with-a-bundler
  //   resolve: {
  //     alias: {
  //       vue: 'vue/dist/vue.esm-bundler.js'
  //     }
  //   }
};