-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ReferenceError: self is not defined - prism-keep-markup #2257
Comments
What browser is this in? When I pull this up in Chrome, |
Why do we pass |
@mAAdhaTTah I use Chrome, also tested on Safari and Brave. I did, however, try adding the following: const isBrowser = typeof window !== 'undefined';
if (isBrowser) {
Prisma.highlightAll();
} yields same result. That said, it looks like the error occurs not on the call, but on the @RunDevelopment - I'm guessing this question is not for me(?) |
No, it wasn't. Sorry for not clarifying. |
@RunDevelopment Yeah, we're pretty inconsistent on how we check what the global variable is, looking at our plugins.
That makes sense, because that's when |
Ok. So removing the passing-in of That said, there are some other underlying issues uncovered by this. |
If self or document don't exist, they'll error instead of getting to the checks. Fixes #2257.
If self or document don't exist, they'll error instead of getting to the checks. Fixes #2257.
If self or document don't exist, they'll error instead of getting to the checks. Fixes #2257.
If self or document don't exist, they'll error instead of getting to the checks. Fixes PrismJS#2257.
Information:
.babelrc
{ ... ["line-numbers", "show-language", "keep-markup"]
Does the latest version of Prism from the download page also have this issue?
Yes
Description

After adding
"keep-markup"
to the plugins list, the app fails:Example
Reproduction available below
PS you can stop the app from crashing by disabling
"keep-markup"
in .babelrchttps://codesandbox.io/s/nextjs-prismjs-slate-u5rmz
The text was updated successfully, but these errors were encountered: