ice icon indicating copy to clipboard operation
ice copied to clipboard

使用ssr 渲染时使用微模块报错

Open oldCabbage opened this issue 3 years ago • 1 comments

使用ssr 渲染时使用微模块报错

UnhandledPromiseRejectionWarning: ReferenceError: window is not defined 微模块不给参数也报错 微信截图_20220804154545

解决ssr渲染时的报错,或者微模块在客户端时在渲染

Any additional comments? 相关环境信息?

  • ice.js Version:2.0.0
  • build.json Configuration:{ "vite": false, "ssr": true, "outputAssetsPath": { "js": "js-csdn", "css": "css-csdn" }, "outputDir": "dist", "externals": { "@alicloudfe/components": "TeamixUI", "react": "React", "react-dom": "ReactDOM", "moment": "moment", "react-redux": "ReactRedux", "redux-thunk": "var window.ReduxThunk.default", "redux": "Redux" }, "plugins": [ [ "build-plugin-moment-locales", { "locales": [ "zh-cn" ] } ] ], "postcssOptions": { "plugins": { "postcss-nested": true } } }
  • Node Version: 14.0
  • Platform:

oldCabbage avatar Aug 04 '22 07:08 oldCabbage

微模块本身是通过拉取异步 bundle 的方式执行,目前不支持 SSR 渲染

ClarkXia avatar Aug 09 '22 08:08 ClarkXia