@nocobase/app 0.20.0-alpha.10 → 0.20.0-alpha.11

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.
package/client/.umirc.ts CHANGED
@@ -19,16 +19,29 @@ indexGenerator.generate();
19
19
  export default defineConfig({
20
20
  title: 'Loading...',
21
21
  devtool: process.env.NODE_ENV === 'development' ? 'source-map' : false,
22
- favicons: ['/favicon/favicon.ico'],
22
+ favicons: [`{{env.APP_PUBLIC_PATH}}favicon/favicon.ico`],
23
23
  metas: [{ name: 'viewport', content: 'initial-scale=0.1' }],
24
24
  links: [
25
- { rel: 'apple-touch-icon', size: '180x180', ref: '/favicon/apple-touch-icon.png' },
26
- { rel: 'icon', type: 'image/png', size: '32x32', ref: '/favicon/favicon-32x32.png' },
27
- { rel: 'icon', type: 'image/png', size: '16x16', ref: '/favicon/favicon-16x16.png' },
28
- { rel: 'manifest', href: '/favicon/site.webmanifest' },
29
- { rel: 'stylesheet', href: '/global.css' },
25
+ { rel: 'apple-touch-icon', size: '180x180', ref: `{{env.APP_PUBLIC_PATH}}favicon/apple-touch-icon.png` },
26
+ { rel: 'icon', type: 'image/png', size: '32x32', ref: `{{env.APP_PUBLIC_PATH}}favicon/favicon-32x32.png` },
27
+ { rel: 'icon', type: 'image/png', size: '16x16', ref: `{{env.APP_PUBLIC_PATH}}favicon/favicon-16x16.png` },
28
+ { rel: 'manifest', href: `{{env.APP_PUBLIC_PATH}}favicon/site.webmanifest` },
29
+ { rel: 'stylesheet', href: `{{env.APP_PUBLIC_PATH}}global.css` },
30
+ ],
31
+ headScripts: [
32
+ {
33
+ src: `{{env.APP_PUBLIC_PATH}}browser-checker.js`,
34
+ },
35
+ {
36
+ content: `
37
+ window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
38
+ window['__nocobase_api_base_url__'] = '{{env.API_BASE_URL}}';
39
+ window['__nocobase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
40
+ window['__nocobase_ws_url__'] = '{{env.WS_URL}}';
41
+ window['__nocobase_ws_path__'] = '{{env.WS_PATH}}';
42
+ `,
43
+ },
30
44
  ],
31
- headScripts: ['/browser-checker.js'],
32
45
  outputPath: path.resolve(__dirname, '../dist/client'),
33
46
  hash: true,
34
47
  alias: {
@@ -41,6 +54,7 @@ export default defineConfig({
41
54
  proxy: {
42
55
  ...umiConfig.proxy,
43
56
  },
57
+ publicPath: 'auto',
44
58
  fastRefresh: false, // 热更新会导致 Context 丢失,不开启
45
59
  mfsu: false,
46
60
  esbuildMinifyIIFE: true,
@@ -10,7 +10,7 @@ import { createHistory } from './core/history';
10
10
  import { ApplyPluginsType } from 'umi';
11
11
 
12
12
 
13
- const publicPath = "/";
13
+ const publicPath = "auto";
14
14
  const runtimePublicPath = false;
15
15
 
16
16
  async function render() {
@@ -4,10 +4,18 @@ import devDynamicImport from '../.plugins/index';
4
4
 
5
5
  export const app = new Application({
6
6
  apiClient: {
7
- baseURL: process.env.API_BASE_URL,
7
+ // @ts-ignore
8
+ baseURL: window['__nocobase_api_base_url__'] || '/api/',
8
9
  },
10
+ // @ts-ignore
11
+ publicPath: window['__nocobase_public_path__'] || '/',
9
12
  plugins: [NocoBaseClientPresetPlugin],
10
- ws: true,
13
+ ws: {
14
+ // @ts-ignore
15
+ url: window['__nocobase_ws_url__'] || '',
16
+ // @ts-ignore
17
+ basename: window['__nocobase_ws_path__'] || '/ws',
18
+ },
11
19
  loadRemotePlugins: true,
12
20
  devDynamicImport,
13
21
  });