mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
69 lines
1.6 KiB
TypeScript
69 lines
1.6 KiB
TypeScript
import path from "node:path";
|
|
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import { defineConfig } from "vitest/config";
|
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(() => ({
|
|
server: {
|
|
host: "::",
|
|
port: 8080,
|
|
},
|
|
plugins: [
|
|
nodePolyfills({
|
|
include: ["buffer", "process", "stream", "module"],
|
|
exclude: ["http", "https", "net", "tls", "child_process"],
|
|
globals: {
|
|
Buffer: true,
|
|
global: true,
|
|
process: true,
|
|
},
|
|
protocolImports: true,
|
|
}),
|
|
react(),
|
|
],
|
|
build: {
|
|
sourcemap: true,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (id.includes('node_modules')) {
|
|
// get the path after "node_modules/"
|
|
const parts = id.toString().split('node_modules/')[1].split('/');
|
|
|
|
// handle scoped packages (@scope/name)
|
|
const pkgName = parts[0].startsWith('@')
|
|
? `${parts[0]}/${parts[1]}`
|
|
: parts[0];
|
|
|
|
return `npm/${pkgName.replace('@', '')}`;
|
|
}
|
|
if (id.includes('/src/')) {
|
|
return 'app';
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
test: {
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: './src/test/setup.ts',
|
|
onConsoleLog(log) {
|
|
return !log.includes("React Router Future Flag Warning");
|
|
},
|
|
env: {
|
|
DEBUG_PRINT_LIMIT: '0', // Suppress DOM output that exceeds AI context windows
|
|
},
|
|
css: true
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: ["tar-stream", "fflate"],
|
|
},
|
|
})); |