gatsby-plugin - react-muuri 在运行 Gatsby Develop 和 Gatsby Build 时加载问题 Webpack
问题描述
react-muuri 组件出现 Webpack 错误、SSR 错误
无法解析“/luke_projects_all/Luke-site-calypsoBootstrap/calypso/gatsby-ld/node_modules/react-muuri/dist”中的“prop-types”
如果您尝试使用软件包,请确保安装了“prop-types”。如果您尝试使用本地文件,请确保路径正确。
文件:../../node_modules/react-muuri/dist/index.es.js:2:0
我将 react-muuri 组件放在代码拆分函数中,现在它可以工作了。我了解可加载组件已折旧。但它对我的情况有效。
import loadable from '@loadable/component'
const LoadableMuuriMaker = loadable(() => import('../components/muurimaker'))
function MyComponent() {
return (
<div>
<LoadableMuuriMaker />
</div>
)
}
解决方案
推荐阅读
- html - 如何在不使用跨度的情况下让我的所有 h2 使用相同的类?我希望我所有的 h2 都使用 .fancy_underline 类
- c# - 如何将 X(:,J) 等 Fortran 子数组语法转换为 VB.NET 和 C#
- laravel - Supervisord & Laravel - has been attempted too many times or run too long
- python - 我的代码有什么问题?添加“不”后失败。采取的步骤'到代码中
- spring-boot - 如何将 Spring log4j 与 messages.properties 集成?
- selenium - Heroku 脚本托管
- ios - 使用 iCloud PHAsset 请求 AVAsset 返回一个没有 VideoTracks 的 AVAsset
- r - Windows 10 中 R 中的 TensorFlow 安装
- python - Multi-Index - Not able to sort multiple indexes in a single line
- c# - 在 Identity.UI/3.1.8 中登录 Facebook 和 google