Bläddra i källkod

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

tags/1.8.1
17hz 2 månader sedan
förälder
incheckning
f11131f8b5
Inget konto är kopplat till bidragsgivarens mejladress
3 ändrade filer med 2 tillägg och 10 borttagningar
  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 Visa fil

const { basePath, assetPrefix } = require('./utils/var-basePath')
const { codeInspectorPlugin } = require('code-inspector-plugin') const { codeInspectorPlugin } = require('code-inspector-plugin')
const withMDX = require('@next/mdx')({ const withMDX = require('@next/mdx')({
extension: /\.mdx?$/, extension: /\.mdx?$/,


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

+ 0
- 6
web/utils/var-basePath.js Visa fil

// 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 Visa fil



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


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

Laddar…
Avbryt
Spara