sendou.ink/vite.config.ts
2025-12-30 17:03:13 +02:00

41 lines
1.1 KiB
TypeScript

import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import babel from "vite-plugin-babel";
import tsconfigPaths from "vite-tsconfig-paths";
import { configDefaults } from "vitest/config";
export default defineConfig(() => {
return {
ssr: {
noExternal: ["react-charts", "react-use"],
},
esbuild: {
supported: {
"top-level-await": true, //browsers can handle top-level-await features
},
},
plugins: [
reactRouter(),
babel({
filter: /\.[jt]sx?$/,
babelConfig: {
presets: ["@babel/preset-typescript"],
plugins: [["babel-plugin-react-compiler", {}]],
},
}),
tsconfigPaths(),
],
test: {
exclude: [...configDefaults.exclude, "e2e/**"],
setupFiles: ["./app/test-setup.ts"],
},
build: {
// this is mostly done so that i18n jsons as defined in ./app/modules/i18n/loader.ts
// do not end up in the js bundle as minimized strings
// if we decide later that this is a useful optimization in some cases then we can
// switch the value to a callback one that checks the file path
assetsInlineLimit: 0,
},
};
});