mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-08-07 09:23:07 +02:00
1a4b58b473
Vite 8 replaces Rollup with Rolldown as the bundler engine. This requires migrating build.rollupOptions to build.rolldownOptions and the removed object-form manualChunks to the new codeSplitting.groups API. Migrate vite.config.ts: - rollupOptions -> rolldownOptions - manualChunks object -> codeSplitting.groups with RegExp test patterns (vendor: react/react-dom/react-router, i18n: i18next packages) @vitejs/plugin-react@6 requires vite@^8 as peer dependency, so both upgrades must land together. Verified: npm run build succeeds (chunks: vendor 230KB, i18n 55KB), tsc --noEmit clean, 339/339 vitest tests passing.
42 lines
969 B
TypeScript
42 lines
969 B
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { resolve } from "node:path";
|
|
|
|
const SPA_REACT = resolve(
|
|
__dirname,
|
|
"src/meshcore_hub/web/static/js/spa-react",
|
|
);
|
|
const DIST = resolve(__dirname, "src/meshcore_hub/web/static/dist");
|
|
|
|
export default defineConfig({
|
|
base: "/static/dist/",
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
"@": SPA_REACT,
|
|
},
|
|
},
|
|
build: {
|
|
outDir: DIST,
|
|
emptyOutDir: true,
|
|
manifest: true,
|
|
rolldownOptions: {
|
|
input: resolve(SPA_REACT, "index.html"),
|
|
output: {
|
|
codeSplitting: {
|
|
groups: [
|
|
{
|
|
name: "vendor",
|
|
test: /[\\/]node_modules[\\/](react|react-dom|react-router)[\\/]/,
|
|
},
|
|
{
|
|
name: "i18n",
|
|
test: /[\\/]node_modules[\\/](i18next|react-i18next|i18next-browser-languagedetector)[\\/]/,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|