Skip to content

Commit 2d9bb9b

Browse files
committed
perf: drop livechat sourcemaps from meteor bundle and clean dist on build
The livechat widget's webpack build emits full source-map files (~12 MB in a fresh build, far more with accumulated rebuilds). They are copied into apps/meteor/public/livechat/ by the rocketchat-livechat plugin and end up in the Meteor bundle and Docker image without adding runtime value. - plugin/build.sh: delete .map files after copying dist into public. Maps remain in packages/livechat/dist for local debugging or upload to error tracking. - packages/livechat: prefix build with yarn clean so dist no longer accumulates stale hashed chunks across rebuilds (noticed dist growing to ~500 MB locally vs. ~18 MB fresh).
1 parent 9760d84 commit 2d9bb9b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

apps/meteor/packages/rocketchat-livechat/plugin/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ echo "Installing Livechat ${LATEST_LIVECHAT_VERSION}..."
1616
cd $LIVECHAT_DIR
1717

1818
cp -a $ROOT/../../packages/livechat/dist/. ./
19+
# Sourcemaps remain in packages/livechat/dist for local debugging / upload
20+
# to error tracking, but should not be baked into the Meteor bundle and
21+
# Docker image (they account for ~360 MB of the shipped widget).
22+
find . -name '*.map' -delete
1923
# change to lowercase so all injected junk from rocket.chat is not sent: https://github.com/meteorhacks/meteor-inject-initial/blob/master/lib/inject-core.js#L10
2024
# this is not harmful since doctype is case-insesitive: https://www.w3.org/TR/html5/syntax.html#the-doctype
2125
meteor node -e 'fs.writeFileSync("index.html", fs.readFileSync("index.html").toString().replace("<!DOCTYPE", "<!doctype"));'

packages/livechat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"/build"
1313
],
1414
"scripts": {
15-
"build": "cross-env TS_NODE_PROJECT=\"tsconfig.webpack.json\" webpack-cli --mode production",
15+
"build": "yarn clean && cross-env TS_NODE_PROJECT=\"tsconfig.webpack.json\" webpack-cli --mode production",
1616
"build-storybook": "storybook build",
1717
"clean": "rimraf dist",
1818
"dev": "yarn build",

0 commit comments

Comments
 (0)