Skip to content

Commit 7836970

Browse files
author
FalkWolsky
committed
further Modifications on SDK build to splitup chunks
1 parent cb1c3a1 commit 7836970

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

Diff for: client/packages/lowcoder-sdk/analyse.html

+1-1
Large diffs are not rendered by default.

Diff for: client/packages/lowcoder-sdk/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@rollup/plugin-json": "^5.0.1",
3737
"@rollup/plugin-node-resolve": "^14.1.0",
3838
"@rollup/plugin-replace": "^5.0.1",
39+
"@rollup/plugin-strip": "^3.0.4",
3940
"@rollup/plugin-url": "^7.0.0",
4041
"@svgr/rollup": "^6.3.1",
4142
"@vitejs/plugin-react": "^2.2.0",

Diff for: client/packages/lowcoder-sdk/vite.config.mts

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { globalDepPlugin } from "./src/dev-utils/globalDepPlguin";
99
import dynamicImport from 'vite-plugin-dynamic-import';
1010
import { visualizer } from "rollup-plugin-visualizer";
1111
import { terser } from 'rollup-plugin-terser';
12+
import strip from "@rollup/plugin-strip";
1213

1314
const isVisualizerEnabled = !!process.env.ENABLE_VISUALIZER;
1415

@@ -54,6 +55,12 @@ export const viteConfig: UserConfig = {
5455
fileName: "lowcoder-sdk",
5556
},
5657
rollupOptions: {
58+
treeshake: {
59+
moduleSideEffects: false,
60+
propertyReadSideEffects: false,
61+
tryCatchDeoptimization: false,
62+
unknownGlobalSideEffects: false,
63+
},
5764
external: ["react", "react-dom"],
5865
output: {
5966
chunkFileNames: "chunks/[name]-[hash].js",
@@ -181,7 +188,11 @@ export const viteConfig: UserConfig = {
181188
minChunkSize: 300000, // 📏 Force smaller chunks (~300KB)
182189
},
183190
plugins: [
184-
terser()
191+
terser(),
192+
strip({
193+
functions: ["console.log", "debugger"], // ✅ Remove logs
194+
sourceMap: true,
195+
}),
185196
],
186197
onwarn: (warning, warn) => {
187198
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {

Diff for: client/yarn.lock

+17
Original file line numberDiff line numberDiff line change
@@ -3663,6 +3663,22 @@ __metadata:
36633663
languageName: node
36643664
linkType: hard
36653665

3666+
"@rollup/plugin-strip@npm:^3.0.4":
3667+
version: 3.0.4
3668+
resolution: "@rollup/plugin-strip@npm:3.0.4"
3669+
dependencies:
3670+
"@rollup/pluginutils": ^5.0.1
3671+
estree-walker: ^2.0.2
3672+
magic-string: ^0.30.3
3673+
peerDependencies:
3674+
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
3675+
peerDependenciesMeta:
3676+
rollup:
3677+
optional: true
3678+
checksum: 77a839dedbe46ec2f2a1834428277a9c8addc28989fc013f39c638019fff2aaf7b1c64d79ed8f4361a9f21094cd5d819197e88c9b6483f5a6232282c8e310174
3679+
languageName: node
3680+
linkType: hard
3681+
36663682
"@rollup/plugin-typescript@npm:^12.1.0":
36673683
version: 12.1.0
36683684
resolution: "@rollup/plugin-typescript@npm:12.1.0"
@@ -14061,6 +14077,7 @@ coolshapes-react@lowcoder-org/coolshapes-react:
1406114077
"@rollup/plugin-json": ^5.0.1
1406214078
"@rollup/plugin-node-resolve": ^14.1.0
1406314079
"@rollup/plugin-replace": ^5.0.1
14080+
"@rollup/plugin-strip": ^3.0.4
1406414081
"@rollup/plugin-url": ^7.0.0
1406514082
"@svgr/rollup": ^6.3.1
1406614083
"@vitejs/plugin-react": ^2.2.0

0 commit comments

Comments
 (0)