sendou.ink/vite.config.ts
2025-11-01 15:38:27 +02:00

56 lines
1.4 KiB
TypeScript

import { vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import babel from "vite-plugin-babel";
import tsconfigPaths from "vite-tsconfig-paths";
import { configDefaults } from "vitest/config";
installGlobals();
const ReactCompilerConfig = {
target: "18",
};
export default defineConfig(() => {
return {
ssr: {
noExternal: ["react-charts", "react-use"],
},
esbuild: {
supported: {
"top-level-await": true, //browsers can handle top-level-await features
},
},
plugins: [
remix({
ignoredRouteFiles: ["**/.*", "**/*.json", "**/components/*"],
serverModuleFormat: "esm",
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
v3_routeConfig: true,
},
}),
babel({
filter: /\.[jt]sx?$/,
babelConfig: {
presets: ["@babel/preset-typescript"],
plugins: [["babel-plugin-react-compiler", ReactCompilerConfig]],
},
}),
tsconfigPaths(),
],
test: {
exclude: [...configDefaults.exclude, "e2e/**"],
},
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,
},
};
});