mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 13:46:45 +00:00
d7dc8fa4cf
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase Backend Test / sqlite-test (20, false) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, false) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, true) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, false) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, true) (push) Waiting to run
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Test on Windows / build (push) Waiting to run
* feat: auto download pro * feat: improve code * feat: improve code * feat: improve code * feat: improve code * fix: test error * fix: improve code * fix: yarn install error * fix: build error * fix: generatePlugins * fix: test error * fix: download pro command * fix: run error * feat: version * fix: require packageJson * fix: improve code * feat: improve code * fix: improve code * fix: test error * fix: test error * fix: improve code * fix: removable * fix: error * fix: error
80 lines
2.5 KiB
TypeScript
80 lines
2.5 KiB
TypeScript
import { generatePlugins, getUmiConfig } from '@nocobase/devtools/umiConfig';
|
|
import path from 'path';
|
|
import { defineConfig } from 'umi';
|
|
|
|
const umiConfig = getUmiConfig();
|
|
|
|
process.env.MFSU_AD = 'none';
|
|
process.env.DID_YOU_KNOW = 'none';
|
|
|
|
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '').split(',').filter((item) => !item.includes('preset')); // 因为现在 preset 是直接引入的,所以不能忽略,如果以后 preset 也是动态插件的形式引入,那么这里可以去掉
|
|
const isDevCmd = !!process.env.IS_DEV_CMD;
|
|
const appPublicPath = isDevCmd ? '/' : '{{env.APP_PUBLIC_PATH}}';
|
|
|
|
generatePlugins();
|
|
|
|
export default defineConfig({
|
|
title: 'Loading...',
|
|
devtool: process.env.NODE_ENV === 'development' ? 'source-map' : false,
|
|
favicons: [`${appPublicPath}favicon/favicon.ico`],
|
|
metas: [{ name: 'viewport', content: 'initial-scale=0.1' }],
|
|
links: [
|
|
{ rel: 'stylesheet', href: `${appPublicPath}global.css` },
|
|
],
|
|
headScripts: [
|
|
{
|
|
src: `${appPublicPath}browser-checker.js`,
|
|
},
|
|
{
|
|
content: isDevCmd ? '' : `
|
|
window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
|
window['__nocobase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
|
window['__nocobase_api_base_url__'] = '{{env.API_BASE_URL}}';
|
|
window['__nocobase_api_client_storage_prefix__'] = '{{env.API_CLIENT_STORAGE_PREFIX}}';
|
|
window['__nocobase_ws_url__'] = '{{env.WS_URL}}';
|
|
window['__nocobase_ws_path__'] = '{{env.WS_PATH}}';
|
|
`,
|
|
},
|
|
],
|
|
outputPath: path.resolve(__dirname, '../dist/client'),
|
|
hash: true,
|
|
alias: {
|
|
...umiConfig.alias,
|
|
},
|
|
define: {
|
|
...umiConfig.define,
|
|
'process.env.USE_REMOTE_PLUGIN': process.env.USE_REMOTE_PLUGIN,
|
|
},
|
|
proxy: {
|
|
...umiConfig.proxy,
|
|
},
|
|
publicPath: 'auto',
|
|
fastRefresh: false, // 热更新会导致 Context 丢失,不开启
|
|
mfsu: false,
|
|
esbuildMinifyIIFE: true,
|
|
// srcTranspiler: 'esbuild', // 不行,各种报错
|
|
// mfsu: {
|
|
// esbuild: true // 不行,各种报错
|
|
// },
|
|
// 浏览器兼容性,兼容到 2018 年的浏览器
|
|
targets: {
|
|
chrome: 69,
|
|
edge: 79,
|
|
safari: 12,
|
|
},
|
|
codeSplitting: {
|
|
jsStrategy: 'depPerChunk'
|
|
},
|
|
chainWebpack(config, { env }) {
|
|
if (env === 'production') {
|
|
config.plugin('ignore nocobase plugins').use(require('webpack').IgnorePlugin, [
|
|
{
|
|
resourceRegExp: new RegExp(pluginPrefix.join('|')),
|
|
},
|
|
]);
|
|
}
|
|
return config;
|
|
},
|
|
routes: [{ path: '/*', component: 'index' }],
|
|
});
|