Comments (4)
That's so weird. Nothing in react-rte or draft-js uses jQuery. Do you have a stack trace to go with that error?
Weirdly still, the TypeError says cannot find property 'jquery' yet the line is asking for jQuery (case difference).
I wonder if this could be related to jsdom which I'm using in my tests. You could try setting global.window = global
and see if that makes the error disappear, since the actual error is not related to jQuery or Zepto but the fact that window is undefined.
from react-rte.
Oops. It was jQuery not jquery. I changed it.
I have a stack trace but it is useless because it shows the result after being webpacked.
like the following
TypeError: Cannot read property 'jQuery' of undefined
at C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:38109:29
at Object.<anonymous> (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:38124:5)
at Object.module.exports.module.exports.module.deprecate (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:38125:32)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.module.exports._typeof (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:37368:18)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.<anonymous> (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:37115:23)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.<anonymous> (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:37015:19)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.module.exports._typeof (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:36804:29)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.module.exports._typeof (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:36564:25)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.module.exports._typeof (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:36281:26)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.module.exports.module.exports.BOLD.fontWeight (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:32672:29)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.<anonymous> (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:31322:21)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
at Object.<anonymous> (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30974:18)
at __webpack_require__ (C:\Users\ZeroCho\WebstormProjects\zerocho-home\public\server.js:30934:31)
but as I followed the stack trace,
it shows DraftJS -> DraftEditor -> DraftEditorContents -> DraftEditorBlock -> DraftEditorLeaf -> DraftEditorTextNode -> UserAgent -> UserAgentData -> UAParser
then some codes like this
(typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' ? window : undefined)
I checked all above dependencies and none of them use jquery except UAParser,
It's a problem in ua-parser-js but this stops server-side-rendering
ua-parser-js link 869~END
By the way, where should I put global.window = global
? In the server file?
from react-rte.
I was thinking you could try putting global.window = global;
somewhere early in your loading chain. Maybe in your main file before you call your first require/import. It's just a guess really, I have no idea if it will fix anything.
from react-rte.
Finally solved by not using react-rte on server-side-rendering
I wrapped import codes with if (process.env.BROWSER) and made it rendered only if it is in browser environment. Then everything is fine
Still mysterious why this problem happens
from react-rte.
Related Issues (20)
- Appending custom html in the editor
- Warning: componentWillUpdate has been renamed HOT 2
- read the length of value
- How can I update the paste value while pasting it on rich text editor.
- converting between HTML and MD
- Is there any documentation for this?
- Add React 18.x.x HOT 4
- Show URL link on links hover
- Autofocus not working as expected with React hook forms
- How to get WYSIWYG when images are used
- Many newlines causes editor to go into an infinite loop
- Command for new line
- Size of the bullet points has not changed along with texts font sizes
- Not working on JSX
- Jumping cursor on mobile HOT 1
- ReferenceError: window is not defined HOT 1
- Window is not defined error when run from Next HOT 2
- react-rte dependency issue with [email protected] HOT 2
- Not working react-rte HOT 2
- While adding an empty link in popover, it redirects to home url when clicked
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-rte.