如何解决我的 npm 包的 "Critical dependency: the request of a dependency is an expression" 错误?
How to resolve "Critical dependency: the request of a dependency is an expression" error for my npm package?
我有一个名为 all-keyboardevent-keys
的包,它导出一个键盘事件字符串对象。这个包是我创建的另一个包的依赖项,onkey-event-manager
,我已将其包含在 Gatsby 站点中。
每当我在我的站点上启动 Gatsby 开发服务器时,我都会收到以下警告:
WARNING Compiled with 1 warnings
warning in ./node_modules/all-keyboardevent-keys/lib/index.js
Critical dependency: the request of a dependency is an expression
四处寻找,了解到这个警告comes from webpack,一个我不太了解的库
我很乐意在我的包裹中解决这个警告,这样其他用户就不会遇到问题。不幸的是,这个网站和其他网站上的大部分答案都是针对最终用户而不是包维护者的。
作为包作者,我该怎么做才能解决这个警告?
有问题的依赖包 all-keyboard-events
没有正确构建。我用Babel替换了Parcel,更新了构建配置,重新构建,错误解决。
我认为这是 Webpack 过于特殊的一个例子;相反,它捕获了我的测试用例遗漏的错误。
希望这对遇到同样问题的其他人有所帮助。
我有一个名为 all-keyboardevent-keys
的包,它导出一个键盘事件字符串对象。这个包是我创建的另一个包的依赖项,onkey-event-manager
,我已将其包含在 Gatsby 站点中。
每当我在我的站点上启动 Gatsby 开发服务器时,我都会收到以下警告:
WARNING Compiled with 1 warnings
warning in ./node_modules/all-keyboardevent-keys/lib/index.js
Critical dependency: the request of a dependency is an expression
四处寻找,了解到这个警告comes from webpack,一个我不太了解的库
我很乐意在我的包裹中解决这个警告,这样其他用户就不会遇到问题。不幸的是,这个网站和其他网站上的大部分答案都是针对最终用户而不是包维护者的。
作为包作者,我该怎么做才能解决这个警告?
有问题的依赖包 all-keyboard-events
没有正确构建。我用Babel替换了Parcel,更新了构建配置,重新构建,错误解决。
我认为这是 Webpack 过于特殊的一个例子;相反,它捕获了我的测试用例遗漏的错误。
希望这对遇到同样问题的其他人有所帮助。