javascript - 使用 react.lazy 时出现 NamedChunksPlugin webpack 问题
问题描述
当我尝试使用 react.lazy
const someComponent = React.lazy(() => import('COMPONENTS/ActualComponent'));
或者
const someComponent = React.lazy(() => import('../ActualComponent/index.js'));
. webpack 无法加载应用程序
我相信下面的代码正在这样做,但不知道为什么。我是 webpack 的新手,我不确定为什么会这样。
```new webpack.NamedChunksPlugin((chunk) => {
if(chunk.name) return chunk.name;
return chunk.modules.map(
m => path.relative(m.context, m.request)
).join('_');
}),```
这是我看到的错误
^
TypeError: Cannot read property 'map' of undefined
at NamedChunksPlugin.conf.plugins.webpack.NamedChunksPlugin [as nameResolver]```
Any help is appreciated! Thanks in advance !
解决方案
推荐阅读
- c++ - Google Kickstart 2013 Round B Problem Sudoku Checker 给出了错误的答案,但它正在运行
- jquery - 使用 Nivo-Slider jquery 插件循环遍历数组以显示图像
- python - 发送 gzip 数据而不解压缩
- kubernetes - 将 GPU 与 Kubernetes GKE 和节点自动配置一起使用
- ios - 单元测试,测试一个视图控制器是否已经呈现了另一个视图控制器
- r - 如何将数字转换为R中的日期和时间戳?
- python - Gensim:以字符串作为输入而不是字符串列表的单词移动距离
- javascript - 如何将承诺的返回值分配给变量?
- reactjs - 动态分段控制按钮
- python - 如何防止图像被垃圾回收?