我有一个 chai在我的 devDependencies
:
"devDependencies": {
"@types/chai": "4.2.14",
"chai": "4.2.0",
}
Chai 仅用于测试,但我不打算发布测试文件。规则node/no-unpublished-import告诉我:
"chai" is not published
从文档:This intends to prevent "Module Not Found" error after npm publish. 💡 If you want to import devDependencies, please write .npmignore or "files" field of package.json.
我不明白什么是“编写 .npmignore”建议。我需要在那里写什么?
目前,我有以下内容:
.idea/
/.eslintignore
/.eslintrc.yaml
/.gitignore
/.mocharc.yaml
/.npmignore
/tsconfig.json
**.test.ts
最后一个使用 chai 忽略所有测试文件。
最佳答案
我正在使用 require,但规则是相似的:.eslintrc
:
{
"rules": {
"node/no-unpublished-require": ["error", {"devDependencies": true}]
}
}
关于node.js - Node/无未发布的导入 : "chai" is not published,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67551956/