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(workspace): vite config build external dependency

dushusird9a40a23f685
diff --git a/examples/univer-preact-ts/vite.config.ts b/examples/univer-preact-ts/vite.config.ts
index c54fbce33a..91ae307a59 100644
--- a/examples/univer-preact-ts/vite.config.ts
+++ b/examples/univer-preact-ts/vite.config.ts
@@ -46,6 +46,7 @@ export default defineConfig({
// '@univer/core': '@univer/core',
// '@univer/style-universheet': '@univer/style-universheet',
// preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/base-component/vite.config.ts b/packages/base-component/vite.config.ts
index 379e3e127e..b5c66a9a42 100644
--- a/packages/base-component/vite.config.ts
+++ b/packages/base-component/vite.config.ts
@@ -46,11 +46,10 @@ export default defineConfig({
createExternal({
externals: {
'@univer/core': '@univer/core',
+ '@univer/base-render': '@univer/base-render',
'css-vars-ponyfill': 'css-vars-ponyfill',
'react-colorful': 'react-colorful',
- // TODO: build ,still have "new Component$1()).isPureReactComponent"
- preact: 'preact',
- react: 'react',
+ preact: 'preact'
},
}),
],
diff --git a/packages/base-numfmt-engine/vite.config.ts b/packages/base-numfmt-engine/vite.config.ts
index 62bf41dd69..cb044e50f8 100644
--- a/packages/base-numfmt-engine/vite.config.ts
+++ b/packages/base-numfmt-engine/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/base-sheets/vite.config.ts b/packages/base-sheets/vite.config.ts
index ff4dc17771..644c35f398 100644
--- a/packages/base-sheets/vite.config.ts
+++ b/packages/base-sheets/vite.config.ts
@@ -55,8 +55,12 @@ export default defineConfig({
externals: {
'@univer/core': '@univer/core',
'@univer/base-render': '@univer/base-render',
+ '@univer/base-component': '@univer/base-component',
'@univer/style-universheet': '@univer/style-universheet',
+ 'css-vars-ponyfill': 'css-vars-ponyfill',
+ 'nanoid': 'nanoid',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/common-plugin-data/package.json b/packages/common-plugin-data/package.json
index b6779c797b..594439eac3 100644
--- a/packages/common-plugin-data/package.json
+++ b/packages/common-plugin-data/package.json
@@ -44,6 +44,7 @@
"ts-jest": "29.0.1",
"ts-node": "^10.2.1",
"typescript": "^4.4.1-rc",
- "vite": "^2.4.4"
+ "vite": "^2.4.4",
+ "vite-plugin-external": "1.2.3"
}
}
diff --git a/packages/common-plugin-data/vite.config.ts b/packages/common-plugin-data/vite.config.ts
index ac5c7eac3c..4a615d6875 100644
--- a/packages/common-plugin-data/vite.config.ts
+++ b/packages/common-plugin-data/vite.config.ts
@@ -1,6 +1,7 @@
import { defineConfig } from 'vite';
import { name, version } from './package.json';
import path from 'path';
+import createExternal from 'vite-plugin-external';
const resolve = (url: string) => path.resolve(__dirname, url);
@@ -27,6 +28,13 @@ export default defineConfig({
port: 3102,
open: true, // // Automatically open the app in the browser on server start.
},
+ plugins: [
+ createExternal({
+ externals: {
+ '@univer/core': '@univer/core'
+ },
+ }),
+ ],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
diff --git a/packages/core/package.json b/packages/core/package.json
index 7a033fa12d..96114263fa 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -54,6 +54,6 @@
"ts-node": "^10.9.1",
"typescript": "^4.7.4",
"vite": "^3.0.9",
- "vite-plugin-external": "1.2.4"
+ "vite-plugin-external": "1.2.3"
}
}
diff --git a/packages/core/vite.config.ts b/packages/core/vite.config.ts
index 0aa6cb4a29..3e9fa8bc77 100644
--- a/packages/core/vite.config.ts
+++ b/packages/core/vite.config.ts
@@ -34,19 +34,20 @@ export default defineConfig({
port: 3102,
open: true, // // Automatically open the app in the browser on server start.
},
-
+ plugins: [
+ createExternal({
+ externals: {
+ 'dayjs': 'dayjs',
+ 'nanoid': 'nanoid',
+ 'numeral': 'numeral',
+ 'es6-proxy-polyfill': 'es6-proxy-polyfill',
+ 'reflect-metadata': 'reflect-metadata',
+ },
+ }),
+ ],
resolve: {
alias: {
// '@': path.resolve(__dirname, 'src'),
},
},
-
- plugins: [
- // createExternal({
- // externals: {
- // 'es6-proxy-polyfill': 'es6-proxy-polyfill',
- // 'reflect-metadata': 'reflect-metadata',
- // },
- // }),
- ],
});
diff --git a/packages/sheets-plugin-alternating-colors/vite.config.ts b/packages/sheets-plugin-alternating-colors/vite.config.ts
index b5419bdd04..c321db4dda 100644
--- a/packages/sheets-plugin-alternating-colors/vite.config.ts
+++ b/packages/sheets-plugin-alternating-colors/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-clipboard/vite.config.ts b/packages/sheets-plugin-clipboard/vite.config.ts
index ac009fda9b..148cbfa510 100644
--- a/packages/sheets-plugin-clipboard/vite.config.ts
+++ b/packages/sheets-plugin-clipboard/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-comment/vite.config.ts b/packages/sheets-plugin-comment/vite.config.ts
index 894f4f3abe..23ed02f81e 100644
--- a/packages/sheets-plugin-comment/vite.config.ts
+++ b/packages/sheets-plugin-comment/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-conditional-format/vite.config.ts b/packages/sheets-plugin-conditional-format/vite.config.ts
index a05619ea2e..71b35c12b6 100644
--- a/packages/sheets-plugin-conditional-format/vite.config.ts
+++ b/packages/sheets-plugin-conditional-format/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-data-validation/vite.config.ts b/packages/sheets-plugin-data-validation/vite.config.ts
index 10c992db0d..8733b912b5 100644
--- a/packages/sheets-plugin-data-validation/vite.config.ts
+++ b/packages/sheets-plugin-data-validation/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-filter/vite.config.ts b/packages/sheets-plugin-filter/vite.config.ts
index 4ebbde26f6..bd472b0808 100644
--- a/packages/sheets-plugin-filter/vite.config.ts
+++ b/packages/sheets-plugin-filter/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-find/vite.config.ts b/packages/sheets-plugin-find/vite.config.ts
index 803d7fbc8e..2c1d01de6d 100644
--- a/packages/sheets-plugin-find/vite.config.ts
+++ b/packages/sheets-plugin-find/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-freeze/vite.config.ts b/packages/sheets-plugin-freeze/vite.config.ts
index 0c220fca2b..b55f66c64e 100644
--- a/packages/sheets-plugin-freeze/vite.config.ts
+++ b/packages/sheets-plugin-freeze/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-image/vite.config.ts b/packages/sheets-plugin-image/vite.config.ts
index 530cae8ec2..e7cc552e72 100644
--- a/packages/sheets-plugin-image/vite.config.ts
+++ b/packages/sheets-plugin-image/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-link/vite.config.ts b/packages/sheets-plugin-link/vite.config.ts
index e9d9ffc61c..f634bd0a6f 100644
--- a/packages/sheets-plugin-link/vite.config.ts
+++ b/packages/sheets-plugin-link/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-numfmt/src/Basic/Const/index.ts b/packages/sheets-plugin-numfmt/src/Basic/Const/index.ts
index 59d17bb2ce..2b474bd8b6 100644
--- a/packages/sheets-plugin-numfmt/src/Basic/Const/index.ts
+++ b/packages/sheets-plugin-numfmt/src/Basic/Const/index.ts
@@ -2,4 +2,5 @@
export * from './DEFAULT_DATA';
export * from './FORMATDETAIL';
export * from './PLUGIN_NAME';
+export * from './CONFIG';
// @endindex
diff --git a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
index c7c7beb4f3..29039c668a 100644
--- a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
+++ b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
@@ -6,7 +6,7 @@ import { NUMFMT_PLUGIN_NAME } from '../Basic/Const';
import { DEFAULT_DATA } from '../Basic/Const/DEFAULT_DATA';
import { NumfmtPlugin } from '../NumfmtPlugin';
import styles from '../View/UI/index.module.less';
-import { NumftmConfig } from '../Basic/Const/Config';
+import { NumftmConfig } from '../Basic/Const';
export class NumfmtController {
protected _model: NumfmtModel;
diff --git a/packages/sheets-plugin-numfmt/vite.config.ts b/packages/sheets-plugin-numfmt/vite.config.ts
index eba9965fd4..75431f6326 100644
--- a/packages/sheets-plugin-numfmt/vite.config.ts
+++ b/packages/sheets-plugin-numfmt/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-pivot-table/vite.config.ts b/packages/sheets-plugin-pivot-table/vite.config.ts
index 133930c3c2..eb62f73d14 100644
--- a/packages/sheets-plugin-pivot-table/vite.config.ts
+++ b/packages/sheets-plugin-pivot-table/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-print/vite.config.ts b/packages/sheets-plugin-print/vite.config.ts
index f38491edbe..90e6ff3c02 100644
--- a/packages/sheets-plugin-print/vite.config.ts
+++ b/packages/sheets-plugin-print/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-protection/vite.config.ts b/packages/sheets-plugin-protection/vite.config.ts
index 4641697e8c..23d7461bc6 100644
--- a/packages/sheets-plugin-protection/vite.config.ts
+++ b/packages/sheets-plugin-protection/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-screenshot/vite.config.ts b/packages/sheets-plugin-screenshot/vite.config.ts
index 03ef67b5e5..bebb283fb0 100644
--- a/packages/sheets-plugin-screenshot/vite.config.ts
+++ b/packages/sheets-plugin-screenshot/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-sort/vite.config.ts b/packages/sheets-plugin-sort/vite.config.ts
index 09220cea53..c57e5edc91 100644
--- a/packages/sheets-plugin-sort/vite.config.ts
+++ b/packages/sheets-plugin-sort/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/sheets-plugin-split-column/vite.config.ts b/packages/sheets-plugin-split-column/vite.config.ts
index 3eb9da45f6..d65e2ecf34 100644
--- a/packages/sheets-plugin-split-column/vite.config.ts
+++ b/packages/sheets-plugin-split-column/vite.config.ts
@@ -41,6 +41,7 @@ export default defineConfig({
'@univer/core': '@univer/core',
'@univer/style-universheet': '@univer/style-universheet',
preact: 'preact',
+ react: 'react',
},
}),
],
diff --git a/packages/style-universheet/vite.config.ts b/packages/style-universheet/vite.config.ts
index cdfbdcdee9..34b1fc2709 100644
--- a/packages/style-universheet/vite.config.ts
+++ b/packages/style-universheet/vite.config.ts
@@ -46,9 +46,10 @@ export default defineConfig({
createExternal({
externals: {
'@univer/core': '@univer/core',
+ '@univer/base-component': '@univer/base-component',
'css-vars-ponyfill': 'css-vars-ponyfill',
+ 'nanoid': 'nanoid',
'react-colorful': 'react-colorful',
- // TODO: build ,still have "new Component$1()).isPureReactComponent"
preact: 'preact',
react: 'react',
},