skip to Main Content

I tried to make my own extension for Visual Studio Code and ran in some issue.
I did everything like in the guide from https://code.visualstudio.com/api/get-started/your-first-extension.
My vsce version is 2.16.0, my npm version is 9.2.0

First I ran

yo code

and generated an extension with the name "test". Then I ran

cd test
vsce package

and expected a file called something like test.vsix but got the following error:

 ERROR  Extension entrypoint(s) missing. Make sure these files exist and aren't ignored by '.vscodeignore':
  extension/dist/extension.js

The file mentioned in the error message (.vscodeignore):

.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.yarnrc
webpack.config.js
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts

But even if I empty this file there is still the same error. Why? What did I forget?

3

Answers


  1. Chosen as BEST ANSWER

    I have no idea why, but it seems like the default npm and node versions on Linux just don't work correctly in that case. Like in ERROR Extension entrypoint(s) missing while I'm trying to package a developed vscode extension with vsce

    I completely uninstalled node and npm from my system, even deleted the npm directory from my global node_modules and then followed the guide on https://github.com/nodesource/distributions#using-ubuntu to reinstall everything.

    Now it suddenly works...


  2. I ran into similar trouble.

    • I had a working VSCode extension, but vsce package (latest version, v2.15.0) was warning about unnecessary files being included:
    This extension consists of 421 files, out of which 196 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
    
    • Tried using esbuild but it gave warnings about one of my included packages which I could not solve (import * as FormData from 'form-data';
      )
    • Tried following the instructions here to reduce the package size. Code ran well under the extension debugging host, but broke when installing from local .vsix or Marketplace.
    • I had to undo the .vscodeignore changes, here. Seems like I need node_modules and (probably) webpack.config.js files.
    Login or Signup to reply.
  3. my problem is in my package.json "main": "./out/extension.js" is incorrect, should be "main": "./dist/extension.js"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search