浏览代码

fix: basepath did not read from the environment variable (#24870)

tags/1.8.1
17hz 2 个月前
父节点
当前提交
f11131f8b5
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 2 次插入10 次删除
  1. 1
    3
      web/next.config.js
  2. 0
    6
      web/utils/var-basePath.js
  3. 1
    1
      web/utils/var.ts

+ 1
- 3
web/next.config.js 查看文件

@@ -1,4 +1,3 @@
const { basePath, assetPrefix } = require('./utils/var-basePath')
const { codeInspectorPlugin } = require('code-inspector-plugin')
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
@@ -24,8 +23,7 @@ const remoteImageURLs = [hasSetWebPrefix ? new URL(`${process.env.NEXT_PUBLIC_WE

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath,
assetPrefix,
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
webpack: (config, { dev, isServer }) => {
if (dev) {
config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' }))

+ 0
- 6
web/utils/var-basePath.js 查看文件

@@ -1,6 +0,0 @@
// export basePath to next.config.js
// same as the one exported from var.ts
module.exports = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
assetPrefix: '',
}

+ 1
- 1
web/utils/var.ts 查看文件

@@ -118,7 +118,7 @@ export const getVars = (value: string) => {

// Set the value of basePath
// example: /dify
export const basePath = ''
export const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ''

export function getMarketplaceUrl(path: string, params?: Record<string, string | undefined>) {
const searchParams = new URLSearchParams({ source: encodeURIComponent(window.location.origin) })

正在加载...
取消
保存