VUE SSR 踩坑

window, document. location, 等client api在服务端无法使用.
如: 滚动监听, 滚动加载组件, 下载组件, 分享组件, 默认不执行, 该在mouted, 或者客户端执行, 进行if判断
渲染错误, 如下

TypeError: Cannot read property '__esModule' of undefined
    at resolve (/Users/wenyejie/workspace/sdh_www_web/node_modules/vue-server-renderer/build.js:7534:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
 
(node:91691) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Can't set headers after they are sent.
 
(node:91691) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

猜你喜欢

转载自blog.csdn.net/weixin_41224029/article/details/90213181