refactor: standardize basePath and assetPrefix in next.config.ts for dashboard and widget
This commit is contained in:
@@ -3,10 +3,13 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/constants"
|
|||||||
|
|
||||||
const backendBaseUrl =
|
const backendBaseUrl =
|
||||||
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() || "http://127.0.0.1:8083"
|
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() || "http://127.0.0.1:8083"
|
||||||
|
const productionBasePath = "/dashboard"
|
||||||
|
|
||||||
export default function nextConfig(phase: string): NextConfig {
|
export default function nextConfig(phase: string): NextConfig {
|
||||||
const config: NextConfig = {
|
const config: NextConfig = {
|
||||||
output: "export",
|
output: "export",
|
||||||
|
basePath: productionBasePath,
|
||||||
|
assetPrefix: `${productionBasePath}/`,
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/constants"
|
|||||||
|
|
||||||
const backendBaseUrl =
|
const backendBaseUrl =
|
||||||
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() || "http://127.0.0.1:8083"
|
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() || "http://127.0.0.1:8083"
|
||||||
|
const productionBasePath = "/widget"
|
||||||
|
|
||||||
export default function nextConfig(phase: string): NextConfig {
|
export default function nextConfig(phase: string): NextConfig {
|
||||||
if (phase === PHASE_DEVELOPMENT_SERVER) {
|
if (phase === PHASE_DEVELOPMENT_SERVER) {
|
||||||
@@ -32,8 +33,8 @@ export default function nextConfig(phase: string): NextConfig {
|
|||||||
return {
|
return {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
output: "export",
|
output: "export",
|
||||||
basePath: "/widget",
|
basePath: productionBasePath,
|
||||||
assetPrefix: "/widget/",
|
assetPrefix: `${productionBasePath}/`,
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
images: {
|
images: {
|
||||||
unoptimized: true,
|
unoptimized: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user