splatoon3.ink/vite.config.js
Matt Isenhower 0462cc2d8c Update Vite from v3 to v6
- vite: 3.2.8 → 6.4.1
- @vitejs/plugin-vue: 3.2.0 → 5.2.4
- Replaced @intlify/vite-plugin-vue-i18n with @intlify/unplugin-vue-i18n
- Narrowed i18n include pattern to *.json to avoid parsing .mjs files

This resolves the esbuild moderate severity vulnerability that was
present in Vite <=6.1.6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:58:07 -08:00

48 lines
1.1 KiB
JavaScript

import { resolve } from 'path';
import { fileURLToPath, URL } from 'url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
const redirectToDist = [
'/assets/splatnet/',
'/data/',
];
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
VueI18nPlugin({
include: resolve(__dirname, './src/assets/i18n/*.json'),
}),
{
// Quick hack to redirect dynamic assets to the /dist/ directory
configureServer(server) {
server.middlewares.use((req, res, next) => {
if (redirectToDist.some(s => req.url.startsWith(s))) {
req.url = '/dist' + req.url;
}
next();
});
},
},
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
emptyOutDir: false,
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
screenshots: resolve(__dirname, 'screenshots/index.html'),
},
},
},
});