使用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:
1条答案
按热度按时间hfyxw5xn1#
微模块本身是通过拉取异步 bundle 的方式执行,目前不支持 SSR 渲染