当我启动webpack并使用带有服务器端渲染功能的koa捆绑我的react应用程序时,会收到警告
Module condition ? './app.component.css': './app.component2.css' not declared as a System.registerDynamic dependency
我应该担心吗?
好吧,几个小时前我在any-promise
github存储库中回答了这个问题:)
所以我只在这里复制答案:
发生这种情况是因为register.js
在24行上具有动态导入:
var lib = require(implementation)
这意味着webpack无法静态解决需求并导入整个包
您可以阅读webpack文档的这一部分:https://webpack.js.org/guides/dependency-management/#require-with-expression
可以使用ContextReplacementPlugin
解决此问题,例如,您可以在Webpack中添加“假”配置以禁止显示此警告
plugins: [
new ContextReplacementPlugin(/any-promise/)
]
我认为您不必担心,因为webpack只需要在服务器应用程序中使用“不必要的”程序包即可。
您还可以跟踪此问题:https://github.com/kevinbeaty/any-promise/issues/31