Spaces:
Sleeping
Sleeping
| import { defineConfig, loadEnv } from "vite"; | |
| import vue from "@vitejs/plugin-vue"; | |
| import { fileURLToPath, URL } from "node:url"; | |
| // https://vitejs.dev/config/ | |
| export default defineConfig(({ mode }) => { | |
| // Load env file based on `mode` in the current working directory. | |
| const env = loadEnv(mode, process.cwd(), ""); | |
| return { | |
| plugins: [ | |
| vue(), | |
| // Plugin to set correct MIME types | |
| { | |
| name: "configure-server", | |
| configureServer(server) { | |
| server.middlewares.use((req, res, next) => { | |
| if (req.url && req.url.endsWith(".wasm")) { | |
| res.setHeader("Content-Type", "application/wasm"); | |
| } | |
| if (req.url && req.url.endsWith(".mjs")) { | |
| res.setHeader("Content-Type", "application/javascript"); | |
| } | |
| next(); | |
| }); | |
| } | |
| } | |
| ], | |
| // Point to parent project's public directory | |
| publicDir: fileURLToPath(new URL("../public", import.meta.url)), | |
| resolve: { | |
| alias: { | |
| "@": fileURLToPath(new URL("./src", import.meta.url)), | |
| "@inc": fileURLToPath(new URL("../inc", import.meta.url)) | |
| } | |
| }, | |
| server: { | |
| host: env.VITE_HOST || "localhost", | |
| port: parseInt(env.VITE_PORT) || 5173, | |
| strictPort: true, | |
| open: false, | |
| fs: { | |
| // Allow serving files from node_modules | |
| allow: ["..", "../.."] | |
| } | |
| }, | |
| optimizeDeps: { | |
| exclude: ["onnxruntime-web"] | |
| }, | |
| build: { | |
| rollupOptions: { | |
| external: ["/lib/tgnParser.cjs"] | |
| } | |
| }, | |
| css: { | |
| preprocessorOptions: { | |
| scss: { | |
| api: "modern" // Use modern Sass API | |
| } | |
| } | |
| }, | |
| define: { | |
| "process.env": {} | |
| } | |
| }; | |
| }); | |