mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
fix build
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import vike from "vike/plugin";
|
||||
import { defineConfig } from "vite";
|
||||
import { cloudflare } from "@cloudflare/vite-plugin";
|
||||
import * as child_process from "node:child_process";
|
||||
|
||||
export default defineConfig(({ command }) => {
|
||||
@@ -23,76 +24,52 @@ export default defineConfig(({ command }) => {
|
||||
prerender: true,
|
||||
}),
|
||||
react(),
|
||||
|
||||
],
|
||||
server: {
|
||||
port: 3000,
|
||||
proxy: {
|
||||
// proxies requests to worker backend
|
||||
"/api": {
|
||||
target: "http://localhost:3001",
|
||||
},
|
||||
"/fonts": {
|
||||
target: "http://localhost:3001/fonts",
|
||||
},
|
||||
// "/api": {
|
||||
// target: "http://localhost:3001",
|
||||
// },
|
||||
// "/fonts": {
|
||||
// target: "http://localhost:3001/fonts",
|
||||
// },
|
||||
},
|
||||
},
|
||||
build: {
|
||||
emitAssets: true,
|
||||
|
||||
emitAssets: false,
|
||||
sourcemap: false,
|
||||
target: ["es2020", "edge88", "firefox78", "chrome87", "safari13"],
|
||||
minify: "terser",
|
||||
terserOptions: {
|
||||
compress: {
|
||||
passes: 4,
|
||||
arrows: true,
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
sequences: true,
|
||||
},
|
||||
mangle: {},
|
||||
ecma: 2020,
|
||||
enclose: false,
|
||||
keep_classnames: false,
|
||||
keep_fnames: false,
|
||||
ie8: false,
|
||||
module: true,
|
||||
nameCache: null,
|
||||
safari10: false,
|
||||
toplevel: true,
|
||||
},
|
||||
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id: string) {
|
||||
if (id.includes("node_modules")) {
|
||||
if (
|
||||
id.includes("shiki/dist/wasm") ||
|
||||
id.endsWith("wasm-inlined.mjs")
|
||||
) {
|
||||
return "@wasm";
|
||||
if (id.includes('node_modules')) {
|
||||
// creating a chunk to react routes deps. Reducing the vendor chunk size
|
||||
if (id.includes('shiki/dist/wasm')) {
|
||||
return '@wasm-bundle';
|
||||
}
|
||||
|
||||
if (
|
||||
id.includes("katex") ||
|
||||
id.includes("marked") ||
|
||||
id.includes("shiki")
|
||||
) {
|
||||
return "@code";
|
||||
if (id.includes('katex') || id.includes('marked') || id.includes('shiki')) {
|
||||
return '@resources-bundle';
|
||||
}
|
||||
|
||||
if (id.includes("react-dom") || id.includes("vike")) {
|
||||
return "@logic";
|
||||
|
||||
if (id.includes('chakra') || id.includes('emotion-react')) {
|
||||
return '@gui-bundle';
|
||||
}
|
||||
|
||||
if (id.includes("mobx") || id.includes("framer-motion")) {
|
||||
return "@framework";
|
||||
|
||||
if (id.includes('react-dom') || id.includes('vike') || id.includes('mobx') || id.includes('framer-motion')) {
|
||||
return '@logic-bundle';
|
||||
}
|
||||
return 'vendor';
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
cssMinify: true,
|
||||
cssMinify: true
|
||||
},
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user