Closed BhagiLimbu closed 3 years ago
Hello!
Do you find a workaround?
@KlochkovIUS ,
I solved it by using a styled component instead of reference css on the file. Here's a link of CSS-in-JS (https://reactjs.net/features/css-in-js.html)
I hope this helps you.
Have same issue, where "import 'some.css" causes the described error.
Would like to have reference to external (s)css, and not mixing styles in the component. suggest to re-open the ticket.
@danielHalan - You can't use document
with server-side rendering because document
is part of the DOM, which doesn't exist server-side.
@Daniel15 Noted that disabling server-side rendering actually removes the error, while css is not included/applied...
Inspecting the added code for CSS loader and for the css file, I cant see any reference to document
.. is there any way to include external css files to the bundle files?
Update: Was a bit quick to reply, Disabling server-side didn't remove the error. (had commented away the import)
Thanks for filing a bug! To save time, if you're having trouble using the library, please check off the items you have tried. If you are just asking a question, skip right to the bottom.
Please verify these steps before filing an issue, and check them off as you go
JavaScriptEngineSwitcher.V8.Native.win-x64
)SetUseReact
andSetUseBabel
is correct inReactConfig.cs
orStartup.cs
I'm using these library versions:
ReactJS.NET
: 5.2.11JavaScriptEngineSwitcher
: 3.8.5react
andreact-dom
: (N/A if using bundled react, or version number) ^16.8.2webpack
: (N/A if using bundled react) ^4.43.0node
: (N/A if using bundled react)Runtime environment:
Steps to reproduce
(Describe your issue here) When I run application that has imported css file on jsx file. It throws an exception.
Steps - 1) Add - import "./test-demo.css"; on home.jsx file 2) Build npm (npm run build) 3) Run application
Results: React.Exceptions.ReactScriptLoadException: Error while loading "/dist/vendor.50cbf625.js": ReferenceError: 'document' is not defined ---> JavaScriptEngineSwitcher.Core.JsRuntimeException: ReferenceError: 'document' is not defined
I am new to ReactJs. Appreciate, if you could suggest sorting out the issue with the CSS file. Thank you.