niuware / mui-rte

Material-UI Rich Text Editor and Viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I am not able install in next js. It shows "SyntaxError: Unexpected token 'export'"

shyamk91 opened this issue · comments

Checklist

Description

Write here your issue description.

I am not able install in next js. It shows "SyntaxError: Unexpected token 'export

Same issue with same conditions

I have the same issue. I notice the message in the console:
(node:90881) [DEP0128] DeprecationWarning: Invalid 'main' field in '.../Documents/Dev/SocialNetwork/sh_client/node_modules/mui-rte/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
I am running Intel mac :
OS Monterey 12.0.1
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.2.5",
"@mui/lab": "^5.0.0-alpha.60",
"@mui/material": "^5.2.5",
"@mui/styles": "^5.2.3",
"mui-rte": "^2.0.0",
"next": "^12.0.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",

mui-rte version 1.29 seems to work so the issue seems to be with V2

hi @chrishj59 @paradoxkb @shyamk91 and others

This issue can be resolved by finding the mui-rte folder in node_modules

and updating the default export in index.js to module.exports = require('./dist/MUIRichTextEditor')

I have made a PR for this here
#292

Is this project still maintained? It's been months since the last commit and #292 is still open.

import dynamic from 'next/dynamic'

const MUIRichTextEditor = dynamic(() => import('mui-rte'), { ssr: false });

you can use dynamic to work around that issue