-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Unexpected token 'export' #509
Comments
I managed to get around this with using a async import Card from '@mui/material/Card'
import { useEffect, useState } from 'react';
import { Prism as ReactSyntaxHighlighter } from 'react-syntax-highlighter'
type Props = {
children?: React.ReactNode
};
export const CardCodeBlock = ({ children }: Props) => {
const [ style, setStyle ] = useState({})
useEffect(() => {
import('react-syntax-highlighter/dist/esm/styles/prism/material-dark')
.then(mod => setStyle(mod.default));
})
return (
<Card>
<ReactSyntaxHighlighter language="html" style={style}>
{children}
</ReactSyntaxHighlighter>
</Card>
)
}
export default CardCodeBlock Is there a typescript or node package.json setting to allow importing js files directly with |
As of 18.04.2023, in the latest version of |
I am using version 15.5.0 and I'm also getting the export issue. @abdelrhman-adel 's workaround solved it for me - cheers for that Abdelr. Running on top of NextJS v12.1.0 |
Still an issue for me in |
Same here! still issue 15.5.0 + nextjs 13.4.9 + reactjs/reacdom 18.2.0 (typescript) bless you bro! |
still issue 15.5.0 + nextjs 13.4.12, thanks @abdelrhman-adel , change the path |
yet another ESM and CJS issue, and add exports field in package.json will pretty much solve this. Consider "pure esm" this package would also work. https://arethetypeswrong.github.io/?p=react-syntax-highlighter%4015.5.0 |
Describe the bug
To Reproduce
Steps to reproduce the behavior:
Installed and used:
Expected behavior
Should not have a compile syntax error.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: