Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS 14 build failed - Expected ';', '}' or <eof> #345

Open
minhphan1704 opened this issue Dec 15, 2023 · 3 comments
Open

NextJS 14 build failed - Expected ';', '}' or <eof> #345

minhphan1704 opened this issue Dec 15, 2023 · 3 comments
Assignees

Comments

@minhphan1704
Copy link

I'm using Suneditor for a Reactjs project with Nextjs 14.
"suneditor": "^2.45.1",
"suneditor-react": "^3.6.1",
nextjs: 14.0.3.
I get this error while working in dev environment:
Expected ';', '}' or <eof> ╭─[.../node_modules/suneditor/src/lib/core.js:1162:1] 1162 │ * @returns {Node} 1163 │ */ 1164 │ getSelectionNode: function () { 1165 │ if (!context.element.wysiwyg.contains(this._variable._selectionNode)) this._editorRange(); · ───────────────────────────────────┬────────────────────────────────── ──── · ╰── This is the expression part of an expression statement 1166 │ if (!this._variable._selectionNode) { 1167 │ const selectionNode = util.getChildElement(context.element.wysiwyg.firstChild, function (current) { return current.childNodes.length === 0 || current.nodeType === 3; }, false); 1167 │ if (!selectionNode) { ╰────
I discovered in function getSelectionNode and specifically line 1165 that contains special characters and is unclear
Screenshot at Dec 15 15-43-55
Then I tried removing them and rewriting them as follows:
Screenshot at Dec 15 15-44-22
and then it works normally. so can we fix it? I think it will cause errors for most of those who have been upgrading nextjs to version 14.

@RobertPastiss
Copy link

I have the same error when i run yarn build. I did the same thing and it's works

@God-lives
Copy link

wow, you are genius man~ thank you very much~

@lugonpedro
Copy link

When building with pnpm I get this same error but with npm build works, this has to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants