Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: reduce the size of the extension (13x improvement on install folder size) #397

Merged
merged 3 commits into from
Jul 29, 2019
Merged

Conversation

badre429
Copy link
Contributor

steps:

  1. refactore package.json and move dependencies to devDependencies because after using webpack all project dependencies are bundled inside the final build
  2. refactore gif and png file on readme.md to use github raw files

Old install directory:

size:32,3 MB (33 926 867 bytes)
size on disk:37,6 MB (39 493 632 bytes)
contains :3 788 Files, 423 Folders

New install directory:

size:2,66 MB (2 800 177 bytes)
size on disk:2,70 MB (2 838 528 bytes)
contains :21 Files, 6 Folders

@Huachao
Copy link
Owner

Huachao commented Jul 29, 2019

@badre429 thanks for your effort to reduce the extension size, however, I think moving the dependencies to devDependencies has no benefit to reducing the extension size after I exclude the node_modules in .vscodeignore file. In previous releases, the node_modules are included in the ultimate extension package. I suggest to only keep the image update part.

@badre429
Copy link
Contributor Author

@Huachao
when you use webpack to build extension you have moving the dependencies to devDependencies for two reason

  1. webpack bundle all dependencies in one file extension.js
  2. vsce builder add all dependencies in package.json to output extension.vsxi file

@Huachao
Copy link
Owner

Huachao commented Jul 29, 2019

@badre429 I am still not quite sure about your second point, I think that all the dependencies are already bundled into the extension.js, while, when creating a vsix file, it will take the .vscodeingore file into consideration, and I already excluded the node_modules in this file (

node_modules
). And this change hasn't been published in any previous releases. In my local test, if I excluded the dependency part, the extension size is still around 3MB

@badre429
Copy link
Contributor Author

badre429 commented Jul 29, 2019

@badre429
Despite the fact that you add 'node_modules' to .vscodeignore file you still end up with 'node_modules' inside the final directory unless you move dependencies to devDependencies in this case you will no longer get 'node_modules' in the final output

you can test moving dependencies to devDependencies and compare the difference

@Huachao
Copy link
Owner

Huachao commented Jul 29, 2019

@badre429
Despite the fact that you add 'node_modules' to .vscodeignore file you still end up with 'node_modules' inside the final directory unless you move dependencies to devDependencies in this case you will no longer get 'node_modules' in the final output

you can test moving dependencies to devDependencies and compare the difference

Are you sure that the node_moduels directory is still in the final output? In my test, I can confirm that no node_modules directory will be generated:

  1. Use vsce package command to generate the .vsix package
  2. Go to the Extensions view of VSCode, and click the ... button on the upper right corner, and select the Install from VSIX and then choose generated .vsix file in the previous step.

After installation, check the folder structure under your extension install path, like ~/.vscode/extensions/, you can find the humao.rest-client -0.xxx folder, and you can check the content there.

@badre429
Copy link
Contributor Author

@Huachao
kept only image file

@Huachao Huachao merged commit db67219 into Huachao:master Jul 29, 2019
@Huachao
Copy link
Owner

Huachao commented Jul 29, 2019

@badre429 Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants