'window is not defined' error when using style-loader with webpack

前端 未结 4 1809
再見小時候
再見小時候 2020-12-11 01:16

Building a server side react app and while using Webpack I am having issues with Style-Loader.

I am using version \"^0.23.1\" and when running a script to bundle and

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 01:54

    I think your problem is, that there is no window object when running js code on a node server. Which also makes sense, as your server has no window where your code is rendered. You can use the global object for global references instead, see this related post here: Does node.js have equivalent to window object in browser

提交回复
热议问题