StructureBuilder / react-keep-alive

A component that maintains component state and avoids repeated re-rendering.
MIT License
984 stars 106 forks source link

Linux下打包出现异常 #2

Closed Estelle00 closed 5 years ago

Estelle00 commented 5 years ago

作者您好, 操作系统:CentOS 7.5 node: 10.15.3 打包工具:umi 生成文件出现 image 错误位置 https://github.com/StructureBuilder/react-keep-alive/blob/e95cef41d72793973f4cf85272c0513d65359300/src/utils/keepAlive.tsx#L278 debug发现此处 cache值为undefined ps: windows环境测试没问题

Estelle00 commented 5 years ago

@Sam618

ShenChang618 commented 5 years ago

@Estelle00 感谢提出问题,能看下发现问题的代码吗?或者给我一个可以复现的实例。

Estelle00 commented 5 years ago

demo https://github.com/Estelle00/demo dist为在centos下打包生成的文件 访问/地址会报错, 404页面未使用keepAlive未报错

ShenChang618 commented 5 years ago

@Estelle00 找到问题了,你提供的 DEMO 中 src/layouts 目录下的 Index.tsx 写错了,应该改成 index.tsx,这样才能让 umi 识别,否则并不会加载这个文件,具体请看 src/layouts/index.js

Estelle00 commented 5 years ago

果然是,谢谢大佬