dimanche 5 janvier 2020

Reactjs Server Side Rendering with .less files as import not working

Spits error on server

webpack:///./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?:62 var style = document.createElement('style'); ^

ReferenceError: document is not defined at insertStyleElement (webpack:///./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?:62:15) at addStyle (webpack:///./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?:177:13) at modulesToDom (webpack:///./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?:56:34) at module.exports (webpack:///./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?:214:3) at eval (webpack:///./src/components/app.less?:15:14) at Object../src/components/app.less (C:\kkungumaraj\react-poc\dist\server.bundle.js:143:1) at webpack_require (C:\kkungumaraj\react-poc\dist\server.bundle.js:20:30) at eval (webpack:///./src/components/App.jsx?:4:67) at Module../src/components/App.jsx (C:\kkungumaraj\react-poc\dist\server.bundle.js:132:1) at webpack_require (C:\kkungumaraj\react-poc\dist\server.bundle.js:20:30) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

i am using run command as node ./dist/server.bundle.js

bundled file which has express server with import of App.jsx

How i can able to use .less file to be rendered on server rendering also or how could i skip server to render my .less imports in every component




Aucun commentaire:

Enregistrer un commentaire