【发布时间】:2021-08-05 16:03:03
【问题描述】:
我的devDependencies 中有一个chai:
"devDependencies": {
"@types/chai": "4.2.14",
"chai": "4.2.0",
}
Chai 仅用于测试,但我不会发布测试文件。 规则node/no-unpublished-import 告诉我:
"chai" is not published
来自文档:
这是为了防止在 npm publish 之后出现“Module Not Found”错误。 ??? 如果要导入 devDependencies,请写 .npmignore 或 package.json 的“文件”字段。
我不明白“写 .npmignore”建议是什么意思。我需要在那里写什么? 目前,我有以下内容:
.idea/
/.eslintignore
/.eslintrc.yaml
/.gitignore
/.mocharc.yaml
/.npmignore
/tsconfig.json
**.test.ts
最后一个使用 chai 忽略所有测试文件。
【问题讨论】: