jodit / jodit/jodit-react

window is not defined render server side

Open
#14 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
406
Forks
131
Avg merge
2h 32m
Merged PRs (30d)
2

Description

Hi I implementing you library with react and nextjs, and when I reload the page, I get the error:

window is not defined
ReferenceError: window is not defined
at Object. (/Users/albertocano/Documents/projects/project/project/node_modules/jodit/build/jodit.min.js:9:224)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.jodit (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:581:18)
at webpack_require (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:23:31)
at Module../pages/test2.jsx (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:421:63)
at webpack_require (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:23:31)
at Object.4 (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:503:18)
at webpack_require (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:23:31)
at /Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:91:18
at Object. (/Users/albertocano/Documents/projects/project/project/.next/server/static/development/pages/test2.js:94:10)

It's obviously that window obejct is only defined on browser side, but do you can support render server side? please

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the server-side reload with the React and Next.js example at pages/test2.jsx, then inspect the jodit import that produces the error in jodit.min.js. Done means the page can render server side without a window ReferenceError; the issue does not identify a repository test or a specific implementation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.