smartxworks / sunmao-ui

A Framework for Developing Low-code Tool
https://sunmao-ui.com
Apache License 2.0
1.38k stars 94 forks source link

fix(runtime): nextjs localstorage is not defined #677

Closed sukbearai closed 1 year ago

sukbearai commented 1 year ago

add utils/isSSR

CLAassistant commented 1 year ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

sukbearai commented 1 year ago
image
sukbearai commented 1 year ago
image

https://github.com/cyberbear181/sunmao-arco-next.git 添加 sunmao-ui 到 next 项目,ssr渲染模式下会报错

tanbowensg commented 1 year ago

挺好的,不过isSSR在runtime和editor里面都写一遍就重复了。应该把他放到 shared 目录中。然后runtime和editor各自从@sunmao/shared 中去 import 进来。

tanbowensg commented 1 year ago

另外不要使用绝对路径,使用相对路径,否则 CI 会挂。不过改成@sunmao/shared应该就不会有引用路径问题了。