Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

build: fix globalName of UMD bundle (#4005)

白熱6721d8d42891
diff --git a/common/shared/vite/index.ts b/common/shared/vite/index.ts
index 18689d24ce..ba9d07e0bb 100644
--- a/common/shared/vite/index.ts
+++ b/common/shared/vite/index.ts
@@ -97,6 +97,15 @@ async function buildUMD(sharedConfig: InlineConfig, options: IBuildExecuterOptio
const { pkg, entry } = options;
return Promise.all(Object.keys(entry).map((key) => {
+ let name = convertLibNameFromPackageName(pkg.name);
+ if (key.includes('facade')) {
+ name = `${name}Facade`;
+ }
+ if (key.includes('locale')) {
+ const localeKey = key.split('/')[1];
+ name = `${name}${convertLibNameFromPackageName(localeKey)}`;
+ }
+
const config: InlineConfig = mergeConfig(sharedConfig, {
build: {
emptyOutDir: false,
@@ -105,7 +114,7 @@ async function buildUMD(sharedConfig: InlineConfig, options: IBuildExecuterOptio
entry: {
[key]: entry[key],
},
- name: convertLibNameFromPackageName(pkg.name),
+ name,
fileName: () => `umd/${key}.js`,
formats: ['umd'],
},
diff --git a/packages/design/vite.config.ts b/packages/design/vite.config.ts
deleted file mode 100644
index cdb3dc98ea..0000000000
--- a/packages/design/vite.config.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { build } from '@univerjs-infra/shared/vite';
-
-build();