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

lrl1mhuk  于 2022-10-22  发布在  其他
关注(0)|答案(1)|浏览(165)

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

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

解决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:

hfyxw5xn

hfyxw5xn1#

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

相关问题