@nocobase/app 2.3.0-beta.14 → 2.3.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,7 +57,7 @@ function createRuntimeHeadScript(appPublicPath: string, isBuild: boolean) {
57
57
  `window['__nocobase_public_path__'] = ${JSON.stringify(appPublicPath)};`,
58
58
  `window['__nocobase_modern_client_prefix__'] = ${JSON.stringify(modernClientPrefix)};`,
59
59
  `window['__nocobase_app_client_entry_mode__'] = ${JSON.stringify(appClientEntryMode)};`,
60
- `window['__nocobase_dev_public_path__'] = "/";`,
60
+ `window['__nocobase_dev_public_path__'] = ${JSON.stringify(appPublicPath)};`,
61
61
  `window['__nocobase_app_dev__'] = ${JSON.stringify(process.env.NOCOBASE_APP_DEV === 'true')};`,
62
62
  `window['__esm_cdn_base_url__'] = ${JSON.stringify(process.env.ESM_CDN_BASE_URL || '')};`,
63
63
  `window['__esm_cdn_suffix__'] = ${JSON.stringify(process.env.ESM_CDN_SUFFIX || '')};`,
@@ -103,7 +103,6 @@ export default defineConfig(({ command }) => {
103
103
  const isDev = !isBuild;
104
104
  const resolvedAppPublicPath = ensurePublicPath(process.env.APP_PUBLIC_PATH, '/');
105
105
  const appPublicPath = isBuild ? APP_PUBLIC_PATH_TEMPLATE : resolvedAppPublicPath;
106
- const htmlPublicPath = isDev ? '/' : appPublicPath;
107
106
  const apiBasePath = ensurePublicPath(process.env.API_BASE_PATH, '/api/');
108
107
  const fileBasePath = ensurePublicPath(`${resolvedAppPublicPath}files/`, '/files/');
109
108
  const localStorageBasePath = ensurePublicPath(`${resolvedAppPublicPath}storage/uploads/`, '/storage/uploads/');
@@ -148,7 +147,7 @@ export default defineConfig(({ command }) => {
148
147
  tag: 'link',
149
148
  attrs: {
150
149
  rel: 'stylesheet',
151
- href: `${htmlPublicPath}global.css`,
150
+ href: `${appPublicPath}global.css`,
152
151
  },
153
152
  publicPath: false,
154
153
  head: true,
@@ -163,7 +162,7 @@ export default defineConfig(({ command }) => {
163
162
  {
164
163
  tag: 'script',
165
164
  attrs: {
166
- src: `${htmlPublicPath}browser-checker.js?v=1`,
165
+ src: `${appPublicPath}browser-checker.js?v=1`,
167
166
  },
168
167
  publicPath: false,
169
168
  head: true,
@@ -313,8 +313,13 @@ export default defineConfig(({ command }) => {
313
313
  middlewares.unshift((req, res, next) => {
314
314
  const [rawPathname = '/', query = ''] = String(req.url || '/').split('?');
315
315
  const pathname = normalizePathname(rawPathname);
316
+ // Strip APP_PUBLIC_PATH first so `/nocobase/admin` maps to `/nocobase/v/admin` instead of
317
+ // `/nocobase/v/nocobase/admin`, and `/nocobase/index.html` is still treated as a document entry.
318
+ const relativePath = isWithinBasePath(pathname, appPublicPath)
319
+ ? normalizePathname(pathname.slice(normalizePathname(appPublicPath).length))
320
+ : pathname;
316
321
  if (
317
- !isClientDocumentEntryPath(pathname) ||
322
+ !isClientDocumentEntryPath(relativePath) ||
318
323
  pathname.startsWith('/.well-known/') ||
319
324
  pathname.startsWith(apiBasePath) ||
320
325
  pathname.startsWith(wsBasePath) ||
@@ -325,7 +330,7 @@ export default defineConfig(({ command }) => {
325
330
  return;
326
331
  }
327
332
  if (!isWithinBasePath(pathname, v2PublicPath)) {
328
- const target = pathname === '/' ? v2PublicPath : `${v2PublicPath.replace(/\/$/, '')}${pathname}`;
333
+ const target = relativePath === '/' ? v2PublicPath : `${v2PublicPath.replace(/\/$/, '')}${relativePath}`;
329
334
  res.statusCode = 302;
330
335
  res.setHeader('Location', `${target}${query ? `?${query}` : ''}`);
331
336
  res.end();