Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

react+antd的组件如何打包能在ssr的项目中使用呢?

我写了一个react+ts+antd的组件,准备打包发布到公司私有npm仓库(webpack打包),但是现在有个问题,在纯react项目中使用没问题,但是在react SSR项目中会报ReferenceError: document is not defined

我看了一下打包好的文件,里面有大量document,而server端没有document,请问这种情况如何处理才能在SSR中使用呢,如何打包呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...