Skip to content

Commit b989d5f

Browse files
committed
build: assets link error
1 parent e38d488 commit b989d5f

3 files changed

Lines changed: 23 additions & 19 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN git clone --depth 1 https://github.com/ReaJason/MemShellParty.git . && \
88
# https://hub.docker.com/r/oven/bun
99
FROM --platform=$BUILDPLATFORM oven/bun:1.3.11 AS frontend
1010

11-
ARG ROUTE_ROOT_PATH="/"
11+
ARG ROUTE_ROOT_PATH=""
1212
ARG CONTEXT_PATH=""
1313

1414
WORKDIR /usr/src/web
@@ -56,4 +56,4 @@ ENV INTERNAL_JAVA_OPTS="\
5656

5757
EXPOSE 8080
5858

59-
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS $INTERNAL_JAVA_OPTS -jar app.jar $BOOT_OPTS"]
59+
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS $INTERNAL_JAVA_OPTS -jar app.jar $BOOT_OPTS"]

web/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
VITE_APP_API_URL=
2-
VITE_APP_BASE_PATH=/ui
2+
VITE_APP_BASE_PATH=/ui

web/vite.config.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,29 @@ import { reactRouter } from "@react-router/dev/vite";
22
import tailwindcss from "@tailwindcss/vite";
33
import mdx from "fumadocs-mdx/vite";
44
import path from "node:path";
5-
import { env } from "node:process";
6-
import { defineConfig } from "vite";
5+
import { defineConfig, loadEnv } from "vite";
76
import devtoolsJson from "vite-plugin-devtools-json";
87

98
import * as MdxConfig from "./source.config";
109

11-
const isDev = env.NODE_ENV === "development";
12-
export default defineConfig({
13-
base: isDev ? "/" : `${env.VITE_APP_API_URL}/`,
14-
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter(), devtoolsJson()],
15-
resolve: {
16-
tsconfigPaths: true,
17-
alias: {
18-
"@": path.resolve(__dirname, "./app"),
19-
...(!isDev
20-
? {
21-
"react-dom/server": "react-dom/server.node",
22-
}
23-
: {}),
10+
export default defineConfig(({ command, mode }) => {
11+
const env = loadEnv(mode, process.cwd(), "VITE_APP_");
12+
const isDev = command === "serve";
13+
const contextPath = env.VITE_APP_API_URL?.trim() ?? "";
14+
15+
return {
16+
base: isDev || !contextPath ? "/" : `${contextPath}/`,
17+
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter(), devtoolsJson()],
18+
resolve: {
19+
tsconfigPaths: true,
20+
alias: {
21+
"@": path.resolve(__dirname, "./app"),
22+
...(!isDev
23+
? {
24+
"react-dom/server": "react-dom/server.node",
25+
}
26+
: {}),
27+
},
2428
},
25-
},
29+
};
2630
});

0 commit comments

Comments
 (0)