Skip to content

Commit 78795b8

Browse files
authored
fix: build error (#427)
1 parent 1202e1c commit 78795b8

File tree

5 files changed

+640
-1949
lines changed

5 files changed

+640
-1949
lines changed

.dumi/theme/builtins/PluginInfo.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ const PluginInfo: React.FC<PluginInfoProps> = (props) => {
4848
const { name, link, plugins, commercial, licenseBundled, deprecated } = props;
4949
const { themeConfig } = useSiteData();
5050
const lang = themeConfig.lang || 'en-US';
51-
const t = messages[lang];
51+
// Fallback to en-US if language is not available
52+
const t = messages[lang] || messages['en-US'];
5253

5354
const edition = licenseBundled && licenseBundled === 'enterprise'
5455
? t.enterpriseEdition
@@ -62,11 +63,13 @@ const PluginInfo: React.FC<PluginInfoProps> = (props) => {
6263
const paths = {
6364
'zh-CN': '/cn/commercial',
6465
'ja-JP': '/jp/commercial',
65-
'en-US': '/en/commercial'
66+
'en-US': '/en/commercial',
67+
'ru-RU': '/en/commercial', // Fallback to English for Russian
68+
'fr-FR': '/en/commercial' // Fallback to English for French
6669
};
6770

6871
return (
69-
<a target="_blank" rel="noreferrer" href={`${t.commercialBaseUrl}${paths[lang]}`}>
72+
<a target="_blank" rel="noreferrer" href={`${t.commercialBaseUrl}${paths[lang] || paths['en-US']}`}>
7073
{text}
7174
</a>
7275
);
@@ -76,11 +79,13 @@ const PluginInfo: React.FC<PluginInfoProps> = (props) => {
7679
const paths = {
7780
'zh-CN': '/cn/plugins',
7881
'ja-JP': '/jp/plugins',
79-
'en-US': '/en/plugins'
82+
'en-US': '/en/plugins',
83+
'ru-RU': '/en/plugins', // Fallback to English for Russian
84+
'fr-FR': '/en/plugins' // Fallback to English for French
8085
};
8186

8287
return (
83-
<a target="_blank" rel="noreferrer" href={`${t.commercialBaseUrl}${paths[lang]}`}>
88+
<a target="_blank" rel="noreferrer" href={`${t.commercialBaseUrl}${paths[lang] || paths['en-US']}`}>
8489
{t.commercialLicense}
8590
</a>
8691
);

.dumi/theme/locale/pluginInfo.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ export default {
4444
enterpriseEdition: 'корпоративная версия',
4545
commercialBaseUrl: 'https://www.nocobase.com'
4646
},
47+
'fr-FR': {
48+
info: 'INFO',
49+
deprecatedInfo: 'OBSOLÈTE',
50+
bundledPluginMessage: 'Cette fonctionnalité est fournie par le plugin commercial {plugins}, inclus dans {edition}, sans achat supplémentaire requis.',
51+
commercialEdition: 'édition commerciale',
52+
pluginMessage: 'Cette fonctionnalité est fournie par le plugin {commercial} {plugins}.{license}',
53+
commercial: 'commercial',
54+
licenseDetails: 'Pour plus de détails, veuillez consulter la {license}.',
55+
commercialLicense: 'Licence commerciale',
56+
deprecatedMessage: '⚠️ Cette fonctionnalité est obsolète et n\'est pas recommandée pour les nouveaux projets.',
57+
enterpriseEdition: 'édition entreprise',
58+
commercialBaseUrl: 'https://www.nocobase.com'
59+
},
4760
'en-US': {
4861
info: 'INFO',
4962
deprecatedInfo: 'DEPRECATED',

.dumirc.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,21 @@ if (lang==='zh-CN'){
3737

3838
export default defineConfig({
3939
hash: true,
40-
alias: {},
40+
alias: {
41+
'cytoscape/dist/cytoscape.umd.js': require.resolve('cytoscape/dist/cytoscape.umd.js'),
42+
},
43+
chainWebpack(config) {
44+
// 处理 cytoscape 导入问题
45+
config.module
46+
.rule('mjs')
47+
.test(/\.mjs$/)
48+
.include
49+
.add(/node_modules/)
50+
.end()
51+
.type('javascript/auto');
52+
53+
return config;
54+
},
4155
exportStatic: {
4256
ignorePreRenderError: true,
4357
},

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@commitlint/cli": "^18.2.0",
3333
"@commitlint/config-conventional": "^18.1.0",
3434
"cross-env": "^7.0.3",
35-
"dumi": "2.2.14",
35+
"dumi": "^2.2.14",
3636
"husky": "^8.0.3",
3737
"lint-staged": "^15.0.2",
3838
"prettier": "^3.0.3"
@@ -41,10 +41,9 @@
4141
"@formulajs/formulajs": "^4.4.9",
4242
"@nocobase/client": "^0.21.0-alpha.6",
4343
"axios-mock-adapter": "1.22.0",
44+
"cytoscape": "^3.23.0",
4445
"dumi-theme-nocobase": "^0.2.31",
4546
"moment": "^2.30.1",
46-
"react": "^19.1.1",
47-
"react-dom": "^19.1.1",
4847
"sucrase": "^3.0.0",
4948
"vditor": "^3.10.8"
5049
},

0 commit comments

Comments
 (0)