问题
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,
