问题

VUE引用一个新的依赖后,编译打包时出现如下警告:

 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

关键依赖:require函数的使用方式无法静态提取依赖项。

原因

webpack 在使用变量作为require路径时,打包出现 Critical dependencies 警告

解决

在webpack的module配置中增加如下设置,

unknownContextCritical: false,

在这里插入图片描述

GitHub 加速计划 / de / Dependencies
36
1
下载
A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.
最近提交(Master分支:1 个月前 )
1997a400 - 3 年前
2f423539 - 3 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐