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(build): update obfuscator condition (#3709)

#FF000097194588fcbb
diff --git a/common/shared/vite/index.js b/common/shared/vite/index.js
index 90640a7872..518f923ac0 100644
--- a/common/shared/vite/index.js
+++ b/common/shared/vite/index.js
@@ -73,7 +73,9 @@ function createViteConfig(overrideConfig, /** @type {IOptions} */ options) {
entryRoot: 'src',
outDir: 'lib/types',
}),
- obfuscator(),
+ ...(
+ pkg.name.startsWith('@univerjs/') ? [] : [obfuscator()]
+ ),
buildPkg(),
],
define: {
diff --git a/common/shared/vite/obfuscator.js b/common/shared/vite/obfuscator.js
index 03c6020c62..61dd0fc919 100644
--- a/common/shared/vite/obfuscator.js
+++ b/common/shared/vite/obfuscator.js
@@ -21,6 +21,11 @@ exports.obfuscator = function obfuscator() {
name: 'obfuscator',
enforce: 'post',
async generateBundle(_options, bundle) {
+ // debug mode
+ // eslint-disable-next-line node/prefer-global/process
+ if (process.env.NODE_ENV === 'development') {
+ return;
+ }
for (const file in bundle) {
if (bundle[file].type === 'chunk' && /\.js$/.test(file)) {
const code = bundle[file].code;