Skip to content

vsce: optimize package size

Administrator requested to merge bee/vsce-package into main

Created by: abeatrix

Close https://github.com/sourcegraph/sourcegraph/issues/36192

Summary

We are currently getting warnings about files size when building the extension:

❯ yarn build:test
  WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
  Entrypoints:
    searchPanel (5.31 MiB)
    searchSidebar (6.14 MiB)
    helpSidebar (1.92 MiB)

Resulting in the package size at 10.89MB

❯ vsce package
 DONE  Packaged: /Users/b/sourcegraph/client/vscode/sourcegraph-2.2.3.vsix (103 files, 10.89MB)

Fix

Changes made included:

The changes from this PR has reduced the build and package size by half, from 10.89MB to 5.17MB

❯ vsce package
DONE  Packaged: /Users/bwork/Dev/sourcegraph/client/vscode/sourcegraph-2.2.3.vsix (124 files, 5.17MB)

No more warnings when running yarn build:test

❯ yarn build:test
yarn run v1.22.17
warning [email protected]: The engine "vscode" appears to be invalid.
$ NODE_ENV=production TARGET_TYPE=webworker IS_TEST=true yarn task:gulp webpack
warning [email protected]: The engine "vscode" appears to be invalid.
$ cross-env NODE_OPTIONS="--max_old_space_size=8192" gulp webpack
[16:23:10] Using gulpfile ~/Dev/sourcegraph/client/vscode/gulpfile.js
[16:23:10] Starting 'webpack'...
[16:24:45] extension:webworker:
  extension:webworker compiled in 55184 ms

webviews:
  webviews compiled in 94688 ms
[16:24:45] Finished 'webpack' after 1.57 min
✨  Done in 96.11s.

The build is also working as expected: Screen Shot 2022-05-27 at 4 09 44 PM

Test plan

Build from this PR is passing the integration test:

VSCode started in debug mode on http://127.0.0.1:29378
    ✓ works (10179ms)


  1 passing (34s)

✨  Done in 41.49s.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading