How to test an npm module with peerDependencies?

后端 未结 2 859
暖寄归人
暖寄归人 2021-01-17 09:05

I am new to understand peerDependencies, and I have read the following references seeking as to how to test an npm module contains peerDependencies within i

相关标签:
2条回答
  • 2021-01-17 09:20

    In my case, I developed a library last time that use ioredis as peer dependency. My solution was to put that library as well in dev dependency.

    // package.json
    "peerDependencies": {
        "ioredis": "4.x"
    },
    "devDependencies": {
        "ioredis": "4.x"
    }
    

    it worked well and no issue so far using this approach.

    0 讨论(0)
  • 2021-01-17 09:20

    I had connected with the authors of npm-install-peers, and the response from one of the authors,

    When it comes to testing your package/project on CI, I believe the correct way to do things is manually adding your peer dependencies to your dev dependencies. No need for this little tool.

    0 讨论(0)
提交回复
热议问题