vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Packaging runtime dependencies without shipping the entire node_modules directory

Open fangfuzha opened this issue 4 weeks ago • 3 comments

Hello! I noticed this VS Code extension package includes a node_modules directory.

Would it be worth considering a leaner packaging strategy?

  • Use the files field in package.json as an explicit allowlist for files required at runtime and by the VS Code Marketplace.
  • Bundle JavaScript/TypeScript runtime dependencies into the extension output with esbuild, webpack, tsup, or a similar tool where practical.
  • Exclude development dependencies, tests, type packages, and unrelated platform files from the VSIX.
  • Keep only dependencies or resources that cannot be bundled, such as native modules, binaries, dynamically loaded modules, or required package assets.

This can reduce VSIX size and installation overhead while preserving runtime behavior. It is not a request to change blindly: native modules, dynamic loading, externalized dependencies, and separately launched Node processes should be validated before removing anything.

If this repository already has an intentional reason to ship node_modules, documenting that reason in the packaging configuration could also help future maintainers.

fangfuzha avatar Nov 02 '26 10:11 fangfuzha

@fangfuzha We don't package the node_modules directory -- where are you seeing it being packaged in the vsix?

sean-mcmanus avatar Nov 02 '26 16:11 sean-mcmanus

@sean-mcmanus I saw node_modules in .yarn-bootstrap in the vsix. Does the extension run depend on .yarn-bootstrap?

fangfuzha avatar Nov 02 '26 16:11 fangfuzha

@fangfuzha Ah, yeah, that .yarn-bootstrap is supposed to be excluded from the .vsix, thanks for catching that.

sean-mcmanus avatar Nov 02 '26 22:11 sean-mcmanus