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.

feat: optimize the packaging size of examples (#672)

白熱0c6a246131e5
diff --git a/examples/docs/esbuild.config.mjs b/examples/docs/esbuild.config.mjs
index 838a890b90..69f2f9d56f 100644
--- a/examples/docs/esbuild.config.mjs
+++ b/examples/docs/esbuild.config.mjs
@@ -19,7 +19,8 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({
bundle: true,
color: true,
loader: { '.svg': 'file' },
- sourcemap: true,
+ sourcemap: args.watch,
+ minify: !args.watch,
plugins: [
cleanPlugin({
patterns: ['./local'],
@@ -47,6 +48,7 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({
outdir: './local',
define: {
+ 'process.env.NODE_ENV': args.watch ? '"development"' : '"production"',
'process.env.GIT_COMMIT_HASH': `"${gitCommitHash}"`,
'process.env.GIT_REF_NAME': `"${gitRefName}"`,
'process.env.BUILD_TIME': `"${new Date().toISOString()}"`,
diff --git a/examples/sheets/esbuild.config.mjs b/examples/sheets/esbuild.config.mjs
index 0347bb8e5d..b06229ddf9 100644
--- a/examples/sheets/esbuild.config.mjs
+++ b/examples/sheets/esbuild.config.mjs
@@ -37,7 +37,8 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({
bundle: true,
color: true,
loader: { '.svg': 'file', '.ttf': 'file' },
- sourcemap: true,
+ sourcemap: args.watch,
+ minify: !args.watch,
plugins: [
copyPlugin({
assets: {
@@ -62,6 +63,7 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({
outdir: './local',
define: {
+ 'process.env.NODE_ENV': args.watch ? '"development"' : '"production"',
'process.env.GIT_COMMIT_HASH': `"${gitCommitHash}"`,
'process.env.GIT_REF_NAME': `"${gitRefName}"`,
'process.env.BUILD_TIME': `"${new Date().toISOString()}"`,
diff --git a/examples/slides/esbuild.config.mjs b/examples/slides/esbuild.config.mjs
index e33cff8a1c..3fa0a0f270 100644
--- a/examples/slides/esbuild.config.mjs
+++ b/examples/slides/esbuild.config.mjs
@@ -19,7 +19,8 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({
bundle: true,
color: true,
loader: { '.svg': 'file' },
- sourcemap: true,
+ sourcemap: args.watch,
+ minify: !args.watch,
plugins: [
cleanPlugin({
patterns: ['./local'],
@@ -47,6 +48,7 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({
outdir: './local',
define: {
+ 'process.env.NODE_ENV': args.watch ? '"development"' : '"production"',
'process.env.GIT_COMMIT_HASH': `"${gitCommitHash}"`,
'process.env.GIT_REF_NAME': `"${gitRefName}"`,
'process.env.BUILD_TIME': `"${new Date().toISOString()}"`,