vscode-docs
vscode-docs copied to clipboard
Update docs to indicate that main and browser should be removed when building platform specific extensions
The following section in the docs could be improved https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions
We do not recommend that extensions ship a different package.json for the web platform or to remove parts of the VSIX that do not work in the web.
When working on an extension for web and desktop, i realized that I must remove the browser
entrypoint in package.json for desktop extensions and main
entry point from web
extension to reduce the bundle size.
The only other option was for me to have bogus *.js files mapped to in the package.json entry points, and that felt hacky.
I think we could state the fact that when publishing for web, the main
entry point should be removed and when publishin for a desktop, the browser
entrypoint from package.json should be removed
Optionally this can be done in the vsce
tool itself.
Either way, I think the recommendation should be to remove main/browser from pacakge.json. As I had to do that to get a smaller bundle and get things working (shipping shipping the files that main points to cases vsce pacakge
to fall over.
Else the doc was a little confusing as this had to be done to recude the bundle size (which I believe is one of the main reasons for having platform specific extensions), and that practice seems to go against the recomendations here We do not recommend that extensions ship a different package.json