microsoft / powerbi-client-react

Power BI for React which provides components and services to enabling developers to easily embed Power BI reports into their applications.
MIT License
310 stars 99 forks source link

"ReferenceError: window is not defined" in Server Side Rendering #15

Closed ksiomelo closed 4 years ago

ksiomelo commented 4 years ago

I've been using ReactJS.NET targeting build to client and server and facing the issue below:

An unhandled exception occurred while processing the request.
NodeInvocationException: Prerendering failed because of error: ReferenceError: window is not defined
at eval (webpack-internal:///./node_modules/powerbi-client-react/dist/powerbi-client-react.js:1:208)
at Object../node_modules/powerbi-client-react/dist/powerbi-client-react.js (/app/ClientApp/dist/main-server.js:1397:1)
at __webpack_require__ (/app/ClientApp/dist/main-server.js:20:30)
at eval (webpack-internal:///./ClientApp/pages/DashboardPage.tsx:7:78)
at Object../ClientApp/pages/DashboardPage.tsx (/app/ClientApp/dist/main-server.js:291:1)
at __webpack_require__ (/app/ClientApp/dist/main-server.js:20:30)
at eval (webpack-internal:///./ClientApp/routes.tsx:13:78)
at Object../ClientApp/routes.tsx (/app/ClientApp/dist/main-server.js:356:1)
at __webpack_require__ (/app/ClientApp/dist/main-server.js:20:30)
at eval (webpack-internal:///./ClientApp/boot-server.tsx:24:66)
Current directory is: /app

Version: "powerbi-client-react": "^1.1.0"

To repro, create a react project in VS from the built in template. Add the powerbi-client-react sample code provided in README.md.

anant-k-singh commented 4 years ago

Powerbi-client-react library does not support server-side rendering at the moment