Spaces:
Running
Running
File size: 1,560 Bytes
466436b 502af73 466436b 502af73 466436b 502af73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
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": {}
}
};
});
|