【问题标题】:Cypress fails with tsconfig.json node_modules/* path赛普拉斯因 tsconfig.json node_modules/* 路径而失败
【发布时间】:2021-06-25 00:59:59
【问题描述】:

所以我遇到了一个问题,类似于这里的问题:https://github.com/cypress-io/cypress/issues/16188

使用 Cypress 和 tsconfig.json 的路径/baseURL 设置如下:

"baseUrl": ".",
"paths": {
  "*": [
    "node_modules/*",
    "app/packs/*"
  ]

会导致错误:

TypeError: validateOptions is not a function
    at new SourceMapDevToolPlugin

删除baseURL 部分或node_modules/* 部分可解决此问题。但是,我不确定为什么。我对 TypeScript 或 webpack 并不完全一致,但删除 node_modules/* 部分似乎不会影响 Web 应用程序(我想删除 baseURL 会导致一些问题)。但我不确定是否有我不知道的副作用?

我的猜测是赛普拉斯正在使用 tsconfig.json 来查找软件包并且正在查看错误的 node_modules 路径....但是从路径中删除 node_modules/* 是否安全,或者我错过了有什么大事?

【问题讨论】:

  • 感谢修复从 tsconfig.json 中的路径中删除 node_modules。这似乎适用于我的 Rails 6 项目!我从没想过要去看那里。

标签: typescript webpack cypress


【解决方案1】:

这似乎可以通过删除baseURL 部分或删除node_modules/* 来解决

在发布 github 问题后,这似乎是柏树的“官方”解决方案。 FWIW 我在删除 node_modules/* 路径时没有发现任何问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-30
    • 2021-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-12
    相关资源
    最近更新 更多