Files
mir-godot/desktop/template/vite.config.ts

83 lines
2.4 KiB
TypeScript
Raw Normal View History

2024-08-06 18:30:21 +08:00
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
2024-04-06 15:11:32 +08:00
import tailwind from "tailwindcss";
import autoprefixer from "autoprefixer";
2024-08-06 18:30:21 +08:00
import path from "path";
import Package from "../package.json";
2024-03-03 22:59:18 +08:00
export default defineConfig({
2024-08-06 18:30:21 +08:00
root: __dirname,
mode: process.env.NODE_ENV,
base: "./",
define: {
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true"
2024-03-03 22:59:18 +08:00
},
plugins: [
2024-08-06 18:30:21 +08:00
vue(
{
template: {
compilerOptions: {
isCustomElement: (tag: any) => ["webview"].includes(tag),
}
}
}
)
2024-03-03 22:59:18 +08:00
],
2024-08-06 18:30:21 +08:00
server: {
host: Package.env.VITE_DEV_SERVER_HOST,
port: Package.env.VITE_DEV_SERVER_PORT,
proxy: {
"/api": {
target: "",
secure: false,
changeOrigin: true,
rewrite: (path: any) => path.replace(/^\/api/, '')
},
}
2024-03-03 22:59:18 +08:00
},
2024-04-06 15:11:32 +08:00
css: {
postcss: {
plugins: [tailwind(), autoprefixer()],
2024-08-06 18:30:21 +08:00
}
},
build: {
outDir: "../release/dist/template",
emptyOutDir: true,
sourcemap: false,
cssCodeSplit: true,
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
2024-04-06 15:11:32 +08:00
},
2024-08-06 18:30:21 +08:00
rollupOptions: {
treeshake: true,
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
const dependenciesKeys = Object.keys(Package.dependencies);
const match = dependenciesKeys.find((item) => {
return id.includes(item);
});
const notSplit = ["vue"];
if (match && !notSplit.includes(match)) {
return match;
}
}
}
}
},
commonjsOptions: {
requireReturnsDefault: "namespace",
}
2024-04-06 15:11:32 +08:00
},
resolve: {
alias: {
2024-08-06 18:30:21 +08:00
"@/lib": path.resolve(__dirname, "./src/packages/shadcn"),
"@/lib/registry/new-york/ui": path.resolve(__dirname, "./src/packages/shadcn"),
"@/lib/registry/default/ui": path.resolve(__dirname, "./src/packages/shadcn")
}
}
})