3 ms·
If you need some sort of "compilation" (e.g. TS->JS, Webpack), you need to run that before the packaging command yourself. A VSCode extension mostly consists of
by phil294 4y ago
If you need some sort of "compilation" (e.g. TS->JS, Webpack), you need to run that before the packaging command yourself. A VSCode extension mostly consists of a single package.json file with a "main" field pointing to some .js file. As far as I understand, vsce does not parse or handle anything, it just checks some metadata and includes the entire folder. This is also why extensions often ship with several files that are not required at runtime.
As to why - since extensions can do anything they want including running bundled binaries, there is no way for the IDE to know which files may or may not be relevant. That doesn't justify going an include-by-default strategy though, an allow-list would be much better.
Is this normal in JS ecosystem? Not really I'd say. NPM packages for example have a "files" property where you specify what to include, and I feel like the general trend is towards a saner approach of modules and imports anyway.
- Dayshine 4y agoThat field is optional in npm, and vsce claims to be using npm as a base for its package structure.