【问题标题】:Why open-wc scaffold does not add required tools as a direct dependency为什么 open-wc 脚手架不添加所需工具作为直接依赖项
【发布时间】:2020-06-13 17:41:08
【问题描述】:

我有一个 webcomponent 项目,我通过一个非常简单的设置进行设置,但我想使用 open-wc。在为 webcomponent 搭建一个项目后,我注意到我的依赖项如下所示:

  "dependencies": {
    "lit-html": "^1.1.2",
    "lit-element": "^2.2.1"
  },
  "devDependencies": {
    "es-dev-server": "^1.23.0",
    "eslint": "^6.1.0",
    "@open-wc/eslint-config": "^2.0.0",
    "@open-wc/prettier-config": "^0.1.10",
    "husky": "^1.0.0",
    "lint-staged": "^8.0.0",
    "@open-wc/testing-karma": "^3.0.0",
    "deepmerge": "^3.2.0",
    "@open-wc/testing-karma-bs": "^1.0.0",
    "@open-wc/testing": "^2.0.0",
    "@open-wc/demoing-storybook": "^1.0.1"
  }

似乎没有对各种工具的直接依赖,而是附加了一层依赖(即@open-wc/eslint-config、@open-wc/prettier-config、@open-wc/demoing-storybook)。

为什么需要额外的层?为什么我不想直接依赖这些工具?对于一些人来说,有直接的依赖关系(即eslint),但对于其他人来说,他们是通过那个额外的层来实现的(即故事书、更漂亮等)。

我在理解整体设置方面有点困难。

【问题讨论】:

    标签: web-component native-web-component


    【解决方案1】:

    您必须询问 open-wc 的具体原因,但原因之一是他们可以构建和测试单个依赖项版本。如果他们依赖 peerDependencies,就无法知道会安装什么版本。

    【讨论】:

      猜你喜欢
      • 2019-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      • 1970-01-01
      • 2021-07-07
      • 1970-01-01
      相关资源
      最近更新 更多