如何使用 webpack 正确捆绑 vscode 扩展 [英] How to correctly bundle a vscode extension using webpack

查看:32
本文介绍了如何使用 webpack 正确捆绑 vscode 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题是,当我运行 vsce package 时,我仍然得到 此扩展名包含 3587 个单独的文件.出于性能原因,您应该捆绑您的扩展: 警告,我遵循了 捆绑扩展 步骤,调试按预期工作.

The problem that i am having is that when i run vsce package i still get the This extension consists of 3587 separate files. For performance reasons, you should bundle your extension: warning, i followed the Bundling Extension steps, debugging works as expected.

package.json

package.json

{
  "main": "./out/extension",
  "scripts": {
    "vscode:prepublish": "webpack --mode production",
    "webpack": "webpack --mode development",
    "webpack-dev": "webpack --mode development --watch",
    "compile": "npm run webpack",
    "watch": "tsc -watch -p ./",
    "postinstall": "node ./node_modules/vscode/bin/install"
  },
}

webpack 配置是 捆绑扩展 示例.

The webpack config is an exact copy of the Bundling Extension example.

推荐答案

这听起来您可能忘记将源目录添加到 .vscodeignore,所以它们仍然被打包到版本中.忽略文件应该至少包含以下内容,以及运行时不需要的任何其他内容:

This sounds like you might've forgotten to add the source directories to .vscodeignore, so they're still being packaged into the release. The ignore file should probably contain at least the following, plus anything else not needed at runtime:

src/**
node_modules/**

这篇关于如何使用 webpack 正确捆绑 vscode 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆