61 lines
1.3 KiB
JavaScript
61 lines
1.3 KiB
JavaScript
// import { defineConfig, splitVendorChunkPlugin } from "vite";
|
|
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import liveReload from "vite-plugin-live-reload";
|
|
import path, { dirname } from "path";
|
|
// import fs from "fs";
|
|
import mkcert from 'vite-plugin-mkcert'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = dirname(__filename)
|
|
const port = 5134
|
|
return {
|
|
root: "src",
|
|
base: mode === "dev" ? "/" : "/dist/",
|
|
|
|
plugins: [
|
|
vue({
|
|
template: {
|
|
transformAssetUrls: {
|
|
base: "plugins/gamutable",
|
|
includeAbsolute: false,
|
|
},
|
|
},
|
|
}),
|
|
liveReload([__dirname + "/**/*.php", __dirname + "/**/*.html"]),
|
|
// splitVendorChunkPlugin(),
|
|
mkcert()
|
|
],
|
|
|
|
// config
|
|
|
|
build: {
|
|
outDir: "../dist",
|
|
emptyOutDir: true,
|
|
manifest: true,
|
|
// cssCodeSplit: false,
|
|
|
|
rollupOptions: {
|
|
input: path.resolve(__dirname, "src/gamutable.js"),
|
|
},
|
|
},
|
|
|
|
server: {
|
|
host: true,
|
|
port: port,
|
|
strictPort: true,
|
|
cors: true,
|
|
},
|
|
|
|
// required for in-browser template compilation
|
|
// https://vuejs.org/guide/scaling-up/tooling.html#note-on-in-browser-template-compilation
|
|
resolve: {
|
|
alias: {
|
|
vue: "vue/dist/vue.esm-bundler.js",
|
|
},
|
|
},
|
|
}
|
|
});
|