webpack-circular-dependency-plugin webpack5 使用

时间: 2023-08-01 20:09:00 浏览: 72
Webpack 5 内置了对循环依赖的支持,因此不再需要使用 `webpack-circular-dependency-plugin` 插件。 如果你使用的是 Webpack 4,可以安装该插件并在 webpack.config.js 中进行配置: ```javascript const CircularDependencyPlugin = require('webpack-circular-dependency-plugin'); module.exports = { // ... plugins: [ new CircularDependencyPlugin({ // exclude detection of files based on a RegExp exclude: /node_modules/, // add errors to webpack instead of warnings failOnError: true, // set the current working directory for displaying module paths cwd: process.cwd(), }), ], }; ``` 其中,`exclude` 选项可以用来排除检测循环依赖的文件,`failOnError` 选项可以将循环依赖检测的警告转换成错误,`cwd` 选项可以设置当前工作目录以显示模块路径。
相关问题

Could not resolve dependency: npm ERR! peer html-webpack-plugin@"^3.0.0 || ^4.0.0" from script-ext-html-webpack-plugin@2.1.5 npm ERR! node_modules/script-ext-html-webpack-plugin npm ERR! dev script-ext-html-webpack-plugin@"2.1.5" from the root project

这个错误信息看起来是在使用 npm 安装某个依赖时出现的。错误提示显示缺少 html-webpack-plugin 的 peer dependency,即 html-webpack-plugin 的版本需要符合 "^3.0.0 || ^4.0.0",而您当前的 script-ext-html-webpack-plugin 版本是 2.1.5,它需要符合这个版本要求。 为了解决这个问题,您可以尝试升级 html-webpack-plugin,或者降低 script-ext-html-webpack-plugin 的版本,使其符合当前已安装的 html-webpack-plugin 的版本要求。 您可以尝试运行以下命令: ``` npm install html-webpack-plugin@^3.0.0 --save-dev ``` 这将安装符合要求的 html-webpack-plugin。如果这个命令没有解决问题,您可以尝试降低 script-ext-html-webpack-plugin 的版本,或者查看其他可能的解决方案。

D:\code\gm>npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: script-ext-html-webpack-plugin@2.0.1 npm ERR! Found: html-webpack-plugin@4.0.0-alpha npm ERR! node_modules/html-webpack-plugin npm ERR! dev html-webpack-plugin@"4.0.0-alpha" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer html-webpack-plugin@"^3.0.0" from script-ext-html-webpack-plugin@2.0.1 npm ERR! node_modules/script-ext-html-webpack-plugin npm ERR! dev script-ext-html-webpack-plugin@"2.0.1" from the root project npm ERR! npm ERR! Conflicting peer dependency: html-webpack-plugin@3.2.0 npm ERR! node_modules/html-webpack-plugin npm ERR! peer html-webpack-plugin@"^3.0.0" from script-ext-html-webpack-plugin@2.0.1 npm ERR! node_modules/script-ext-html-webpack-plugin npm ERR! dev script-ext-html-webpack-plugin@"2.0.1" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! For a full report see: npm ERR! D:\Develop\nodejs\node_cache\_logs\2023-07-20T02_53_20_829Z-eresolve-report.txt npm ERR! A complete log of this run can be found in: npm ERR! D:\Develop\nodejs\node_cache\_logs\2023-07-20T02_53_20_829Z-debug-0.log

这个错误是由于包依赖关系冲突引起的。根据错误日志,你正在安装 `script-ext-html-webpack-plugin@2.0.1`,它依赖于 `html-webpack-plugin@^3.0.0`。然而,在你的项目中已经安装了 `html-webpack-plugin@4.0.0-alpha`,这与 `script-ext-html-webpack-plugin@2.0.1` 的依赖冲突。 解决这个问题的方法有两种: 1. 更新 `script-ext-html-webpack-plugin`,使其与已安装的 `html-webpack-plugin@4.0.0-alpha` 兼容。你可以查看 `script-ext-html-webpack-plugin` 的文档或 GitHub 页面,看看是否有与 `html-webpack-plugin@4.0.0-alpha` 兼容的版本。 2. 更新 `html-webpack-plugin`,使其与 `script-ext-html-webpack-plugin@2.0.1` 兼容。你可以尝试将 `html-webpack-plugin` 更新到版本 `3.2.0` 或更高版本。 你也可以尝试使用 `--force` 或 `--legacy-peer-deps` 参数运行 `npm install` 命令,但这样可能会导致依赖关系解析不准确或出现其他问题,不推荐使用。 请注意,解决依赖冲突问题可能需要根据你的项目具体情况进行调整,建议仔细阅读错误日志并参考相关文档进行操作。

相关推荐

npm install vue-beautiful-chat --save npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: extract-text-webpack-plugin@3.0.2 npm WARN Found: webpack@4.46.0 npm WARN node_modules/webpack npm WARN peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6 npm WARN node_modules/@intervolga/optimize-cssnano-plugin npm WARN @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@3.12.1 npm WARN node_modules/@vue/cli-service npm WARN 24 more (@soda/friendly-errors-webpack-plugin, ...) npm WARN npm WARN Could not resolve dependency: npm WARN peer webpack@"^3.1.0" from extract-text-webpack-plugin@3.0.2 npm WARN node_modules/extract-text-webpack-plugin npm WARN extract-text-webpack-plugin@"^3.0.1" from vue-photo-preview@1.1.3 npm WARN node_modules/vue-photo-preview npm WARN npm WARN Conflicting peer dependency: webpack@3.12.0 npm WARN node_modules/webpack npm WARN peer webpack@"^3.1.0" from extract-text-webpack-plugin@3.0.2 npm WARN node_modules/extract-text-webpack-plugin npm WARN extract-text-webpack-plugin@"^3.0.1" from vue-photo-preview@1.1.3 npm WARN node_modules/vue-photo-preview npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: uglifyjs-webpack-plugin@0.4.6 npm WARN Found: webpack@4.46.0 npm WARN node_modules/webpack npm WARN peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6 npm WARN node_modules/@intervolga/optimize-cssnano-plugin npm WARN @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@3.12.1 npm WARN node_modules/@vue/cli-service npm WARN 24 more (@soda/friendly-errors-webpack-plugin, ...) npm WARN npm WARN Could not resolve dependency: npm WARN peer webpack@"^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0" from uglifyjs-webpack-plugin@0.4.6 npm WARN node_modules/uglifyjs-webpack-plugin npm WARN uglifyjs-webpack-plugin@"^0.4.6" from webpack@3.12.0 npm WARN node_modules/vue-photo-preview/node_modules/webpack npm WARN npm WARN Conflicting peer dependency: webpack@3.12.0 npm WARN node_modules/webpack npm WARN peer webpack@"^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0" from uglifyjs-webpack-plugin@0.4.6 npm WARN node_modules/uglifyjs-webpack-plugin npm WARN uglifyjs-webpack-plugin@"^0.4.6" from webpack@3.12.0 npm WARN node_modules/vue-photo-preview/node_modules/webpack

code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: compression-webpack-plugin@3.1.0 npm ERR! Found: webpack@3.12.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from @soda/friendly-errors-webpack-plugin@1.7.1 npm ERR! node_modules/@soda/friendly-errors-webpack-plugin npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@3.12.1 npm ERR! node_modules/@vue/cli-service npm ERR! dev @vue/cli-service@"^3.3.0" from the root project npm ERR! peer webpack@"2 || 3 || 4" from babel-loader@7.1.5 npm ERR! node_modules/babel-loader npm ERR! babel-loader@"^7.1.2" from vue-photo-preview@1.1.3 npm ERR! node_modules/vue-photo-preview npm ERR! vue-photo-preview@"^1.1.3" from the root project npm ERR! 11 more (eslint-loader, extract-text-webpack-plugin, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack@"^4.3.0 || ^5.0.0" from compression-webpack-plugin@3.1.0 npm ERR! node_modules/compression-webpack-plugin npm ERR! dev compression-webpack-plugin@"^3.1.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.86.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^4.3.0 || ^5.0.0" from compression-webpack-plugin@3.1.0 npm ERR! node_modules/compression-webpack-plugin npm ERR! dev compression-webpack-plugin@"^3.1.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! For a full report see: npm ERR! C:\Users\zcybi\AppData\Local\npm-cache\_logs\2023-06-08T02_41_32_750Z-eresolve-report.txt

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: sass-loader@12.1.0 npm ERR! Found: webpack@3.12.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0" from uglifyjs-webpack-plugin@0.4.6 npm ERR! node_modules/webpack/node_modules/uglifyjs-webpack-plugin npm ERR! uglifyjs-webpack-plugin@"^0.4.6" from webpack@3.12.0 npm ERR! peer webpack@"2 || 3 || 4" from babel-loader@7.1.5 npm ERR! node_modules/babel-loader npm ERR! dev babel-loader@"^7.1.1" from the root project npm ERR! 9 more (extract-text-webpack-plugin, file-loader, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack@"^5.0.0" from sass-loader@12.1.0 npm ERR! node_modules/sass-loader npm ERR! dev sass-loader@"^12.1.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.88.2 npm ERR! node_modules/webpack npm ERR! peer webpack@"^5.0.0" from sass-loader@12.1.0 npm ERR! node_modules/sass-loader npm ERR! dev sass-loader@"^12.1.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! For a full report see: npm ERR! C:\Users\antiy\AppData\Local\npm-cache\_logs\2023-07-18T05_47_37_165Z-eresolve-report.txt npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\antiy\AppData\Local\npm-cache\_logs\2023-07-18T05_47_37_165Z-debug-0.log

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: css-loader@2.1.1 npm ERR! Found: webpack@2.7.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"2 || 3 || 4" from babel-loader@7.1.5 npm ERR! node_modules/babel-loader npm ERR! babel-loader@"^7.1.2" from vue-photo-preview@1.1.3 npm ERR! node_modules/vue-photo-preview npm ERR! vue-photo-preview@"^1.1.3" from the root project npm ERR! dev babel-loader@"^7.1.5" from the root project npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from file-loader@1.1.11 npm ERR! node_modules/file-loader npm ERR! file-loader@"^1.1.4" from vue-photo-preview@1.1.3 npm ERR! node_modules/vue-photo-preview npm ERR! vue-photo-preview@"^1.1.3" from the root project npm ERR! 5 more (less-loader, uglifyjs-webpack-plugin, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack@"^4.0.0" from css-loader@2.1.1 npm ERR! node_modules/css-loader npm ERR! peer css-loader@"*" from vue-loader@15.10.1 npm ERR! node_modules/vue-loader npm ERR! dev vue-loader@"^15.9.5" from the root project npm ERR! dev css-loader@"^2.1.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@4.46.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^4.0.0" from css-loader@2.1.1 npm ERR! node_modules/css-loader npm ERR! peer css-loader@"*" from vue-loader@15.10.1 npm ERR! node_modules/vue-loader npm ERR! dev vue-loader@"^15.9.5" from the root project npm ERR! dev css-loader@"^2.1.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

最新推荐

recommend-type

android手机应用源码Imsdroid语音视频通话源码.rar

android手机应用源码Imsdroid语音视频通话源码.rar
recommend-type

营销计划汇报PPT,市场品牌 推广渠道 产品 营销策略tbb.pptx

营销计划汇报PPT,市场品牌 推广渠道 产品 营销策略tbb.pptx
recommend-type

JavaScript_超过100种语言的纯Javascript OCR.zip

JavaScript
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

可见光定位LED及其供电硬件具体型号,广角镜头和探测器,实验设计具体流程步骤,

1. 可见光定位LED型号:一般可使用5mm或3mm的普通白色LED,也可以选择专门用于定位的LED,例如OSRAM公司的SFH 4715AS或Vishay公司的VLMU3500-385-120。 2. 供电硬件型号:可以使用常见的直流电源供电,也可以选择专门的LED驱动器,例如Meanwell公司的ELG-75-C或ELG-150-C系列。 3. 广角镜头和探测器型号:一般可采用广角透镜和CMOS摄像头或光电二极管探测器,例如Omron公司的B5W-LA或Murata公司的IRS-B210ST01。 4. 实验设计流程步骤: 1)确定实验目的和研究对象,例如车辆或机器人的定位和导航。
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

实现实时监控告警系统:Kafka与Grafana整合

![实现实时监控告警系统:Kafka与Grafana整合](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6X2pwZy9BVldpY3ladXVDbEZpY1pLWmw2bUVaWXFUcEdLT1VDdkxRSmQxZXB5R1lxaWNlUjA2c0hFek5Qc3FyRktudFF1VDMxQVl3QTRXV2lhSWFRMEFRc0I1cW1ZOGcvNjQw?x-oss-process=image/format,png) # 1.1 Kafka集群架构 Kafka集群由多个称为代理的服务器组成,这