首页 > 其他分享 >eslint提示 xxx should be listed in the project's dependencies

eslint提示 xxx should be listed in the project's dependencies

时间:2023-10-25 14:15:26浏览次数:33  
标签:npm xxx should project dependencies eslint true

有时候手动安装了一个npm包A,npm包A里面包含了npm包B,这时候如果

import xxx from 'npm包B';

eslint会报错,提示 npm包B 不在 package.json 里面

 解决方法:在 eslintrc.js 增加配置

module.exports = {
  rules: {
    'import/no-extraneous-dependencies': [
      0,
      {
        devDependencies: true,
        peerDependencies: true
        // optionalDependencies: true,
        // bundledDependencies: true
      }
    ]
  }
};

 

 

标签:npm,xxx,should,project,dependencies,eslint,true
From: https://www.cnblogs.com/djjlovedjj/p/17787069.html

相关文章