学習バンザイITエンジニアの精神安穏日記

ITエンジニアというより、IT系雑務者

【VSCode】yo codeで拡張機能つくるときにwebpack不要にした後にwebpack使う

最初

yo code

この実行時に、webpackをデフォルトで「NO」にした。

その状態でvsce publish拡張機能を公開すると、以下のWarningが出る。

This extension consists of 3296 files, out of which 1979 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 

.vscodeignoreなどに、node_modules/**がないなどの理由で、こういう表示が出てる気がする。

とりあえず、webpack使うように変更する。

やり方

yo code

で、適当なプロジェクトを作成し、webpack使用するようにする。

  • package.json
  • .vscodeignore
  • webpack.config.js

これらのファイルを、開発中のディレクトリに移す。

実行してみる

この状態で、vsce publish実行する

vsce publish

ERROR  @types/vscode ^1.91.0 greater than engines.vscode ^1.50.0. Consider upgrade engines.vscode or use an older @types/vscode version

修正

packge.jsonのenginesのversionを上げた。

     "engines": {
            "vscode": "^1.91.0"
   },

修正2

vsce publish

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

.vscodeignoreのout/**を消した。

成功!