Closed DCLangX closed 2 years ago
晚点看看
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: 爱吃薯片的内存条 @.> 发送时间: 2022年1月24日 10:37 收件人: zhangyuang/ssr @.> 抄送: Subscribed @.***> 主题: Re: [zhangyuang/ssr] vite打包出现'Uncaught TypeError: Cannot read properties of undefined (reading 'exports')' (Issue #159)
详细描述你的问题
大佬,又是我,前天更新了一下依赖,开发模式也是运行正常,,用vite打包出来的文件发现报了个错
经过反复删减,最终发现是我写的axios相关代码打包后报错了,,复制出来在vue3-nestjs-ssr示例测试,可以复现 代码: https://github.com/DCLangX/testSSRError
期望的结果
当前使用的版本
不要贴 package.json 用 yarn list "ssr*" 来查看版本。同时建议熟读semver 规则并且知道怎么安装最新依赖!
复现仓库地址
超过一行代码能描述的问题必须提供复现地址, 用默认的 example 给最简单的复现代码不要给包含着一堆业务代码的仓库
你本人对问题可能的原因判断(如果你能大概判断的话)
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>
fix by e034b6b
昨天的错不报了,不过又出来了新的错( ̄▽ ̄)",这次好像是打包vant出的错 还是这个复现地址: https://github.com/DCLangX/testSSRError 部署预览: http://home.niye.vip:3000/
我在昨天的页面加了两个按钮,axios加了一个弹窗提醒 https://github.com/DCLangX/testSSRError/commit/98ca6d6cac7912d32b1fb667c0a0f0362a3c272e
fix by e034b6b
昨天的错不报了,不过又出来了新的错( ̄▽ ̄)",这次好像是打包vant出的错 还是这个复现地址: https://github.com/DCLangX/testSSRError 部署预览: http://home.niye.vip:3000/
我在昨天的页面加了两个按钮,axios加了一个弹窗提醒 DCLangX/testSSRError@98ca6d6
@zhangyuang 大佬,我后面这个报错,有头绪吗
已经修复了啊 是因为你在store里面引入了页面组件里用到的文件导致循环依赖
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: 爱吃薯片的内存条 @.> 发送时间: 2022年1月27日 13:34 收件人: zhangyuang/ssr @.> 抄送: yuuang @.>, Mention @.> 主题: Re: [zhangyuang/ssr] vite打包出现'Uncaught TypeError: Cannot read properties of undefined (reading 'exports')' (Issue #159)
fix by e034b6b
昨天的错不报了,不过又出来了新的错( ̄▽ ̄)",这次好像是打包vant出的错 还是这个复现地址: https://github.com/DCLangX/testSSRError 部署预览: http://home.niye.vip:3000/
我在昨天的页面加了两个按钮,axios加了一个弹窗提醒 @.***
@zhangyuang 大佬,我后面这个报错,有头绪吗
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>
昨天更到6.1.55,试了报错了,刚刚又试了下,确实还是报了Uncaught ReferenceError: Cannot access 'xu' before initialization
,难道是又是苹果跟windows打包出来有差异,我试下苹果
试了下苹果,确实也是一样
先用webpack构建吧,你这个场景太复杂了,涉及到了很多循环依赖。
支持 ssr build --vite --legacy
关闭 manualChunks
功能用以获得稳定的构建产物,但会带来一定的性能损失,视情况开启https://github.com/zhangyuang/ssr/commit/8f5d9dac405b2a998d1e22d4d1484a6d544697ae
👏有点拼啊,大晚上还在改代码,赞助一个鸡腿🍗
更新了6.1.56,可以再试试
哇,可以了,,上面的测试代码加不加--legacy
都能通过,不过项目里还得加--legacy
才不报错,看来这个manualChunks我能提一打的issue,哈哈🤡
legacy我又移除了 最新的方案应该不需要legacy了 还有问题给复现
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: 爱吃薯片的内存条 @.> 发送时间: 2022年1月28日 17:30 收件人: zhangyuang/ssr @.> 抄送: yuuang @.>, Mention @.> 主题: Re: [zhangyuang/ssr] vite打包出现'Uncaught TypeError: Cannot read properties of undefined (reading 'exports')' (Issue #159)
哇,可以了,,上面的测试代码加不加--legacy都能通过,不过项目里还得加--legacy才不报错,看来这个manualChunks我能提一打的issue,哈哈🤡
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>
提交了新的错误复现
还是这个复现仓库: https://github.com/DCLangX/testSSRError 部署预览: http://home.niye.vip:3000/
这次主要是把页面取store数据封装了hooks,然后又加了const router = useRouter()和const route = useRoute()就出现了循环依赖
详细描述你的问题
大佬,又是我,前天更新了一下依赖,开发模式也是运行正常,,用vite打包出来的文件发现报了个错 经过反复删减,最终发现是我写的axios相关代码打包后报错了,,复制出来在vue3-nestjs-ssr示例测试,可以复现
期望的结果
当前使用的版本
6.1.49
复现仓库地址
代码: https://github.com/DCLangX/testSSRError 部署预览: http://home.niye.vip:3000/
你本人对问题可能的原因判断(如果你能大概判断的话)
可能跟我创建了两个axios实例有关,分别在页面和vuex里有引入两个实例的接口,, 具体细节可以看这个提交 https://github.com/DCLangX/testSSRError/commit/b120fab8b83646841423b77de337582fd0628dfb