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.

chore: optimize startup performance during development (#4199)

白熱2d717ca4f2bc
diff --git a/examples/esbuild.config.ts b/examples/esbuild.config.ts
index 401178492c..fa20a3473e 100644
--- a/examples/esbuild.config.ts
+++ b/examples/esbuild.config.ts
@@ -72,6 +72,39 @@ if (!args.watch) {
define['process.env.BUILD_TIME'] = `"${new Date().toISOString()}"`;
}
+const entryPoints = [
+ // homepage
+ './src/main.tsx',
+
+ // sheets
+ './src/sheets/main.ts',
+ './src/sheets/worker.ts',
+
+ // sheets-multi
+ './src/sheets-multi/main.tsx',
+
+ // sheets-uniscript
+ './src/sheets-uniscript/main.ts',
+
+ // docs
+ './src/docs/main.ts',
+
+ // docs-uniscript
+ './src/docs-uniscript/main.ts',
+
+ // slides
+ './src/slides/main.ts',
+
+ // uni
+ './src/uni/main.ts',
+ './src/uni/worker.ts',
+ './src/uni/lazy.ts',
+
+ // mobile sheet
+ './src/mobile-s/main.ts',
+ './src/mobile-s/worker.ts',
+];
+
const config: SameShape<BuildOptions, BuildOptions> = {
bundle: true,
format: 'esm',
@@ -81,64 +114,50 @@ const config: SameShape<BuildOptions, BuildOptions> = {
sourcemap: args.watch,
minify: false,
target: 'chrome70',
- plugins: [
- copyPlugin({
- assets: {
- from: ['./public/**/*'],
- to: ['./'],
- },
- }),
- stylePlugin({
- postcss: {
- plugins: [tailwindcss],
- },
- cssModulesOptions: {
- localsConvention: 'camelCaseOnly',
- generateScopedName: 'univer-[local]',
+ plugins: [{
+ name: 'ignore-global-css',
+ setup(build) {
+ build.onResolve({ filter: /\/global\.css$/ }, (args) => {
+ if (args.importer.includes('packages')) {
+ return {
+ path: args.path,
+ namespace: 'ignore-global-css',
+ pluginData: {
+ importer: args.importer,
+ },
+ };
+ }
+ });
+
+ build.onLoad({ filter: /\/global\.css$/, namespace: 'ignore-global-css' }, () => {
+ return { contents: '' };
+ });
+ },
+ },
+ copyPlugin({
+ assets: {
+ from: ['./public/**/*'],
+ to: ['./'],
+ },
+ }),
+ stylePlugin({
+ postcss: {
+ plugins: [tailwindcss],
+ },
+ cssModulesOptions: {
+ localsConvention: 'camelCaseOnly',
+ generateScopedName: 'univer-[local]',
+ },
+ renderOptions: {
+ lessOptions: {
+ paths: [nodeModules],
},
- renderOptions: {
- lessOptions: {
- paths: [nodeModules],
- },
- },
- }),
- vue() as unknown as Plugin,
- ],
- entryPoints: [
- // homepage
- './src/main.tsx',
-
- // sheets
- './src/sheets/main.ts',
- './src/sheets/worker.ts',
-
- // sheets-multi
- './src/sheets-multi/main.tsx',
-
- // sheets-uniscript
- './src/sheets-uniscript/main.ts',
-
- // docs
- './src/docs/main.ts',
-
- // docs-uniscript
- './src/docs-uniscript/main.ts',
-
- // slides
- './src/slides/main.ts',
-
- // uni
- './src/uni/main.ts',
- './src/uni/worker.ts',
- './src/uni/lazy.ts',
-
- // mobile sheet
- './src/mobile-s/main.ts',
- './src/mobile-s/worker.ts',
+ },
+ }),
+ vue() as unknown as Plugin,
],
-
+ entryPoints,
outdir: './local',
-
define,
};