question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax Error when load on Firefox Browser v.77.0.1 (64-bit)

See original GitHub issue

Hello i have some problem on Firefox browser, my code runs fine in all browsers except Firefox which is

InvalidIdentity in Regular Expression, you can look at this image

image

On console image

My code

//[slug].tsx

import React, { useEffect } from "react";
import { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from "next";
import { serialize } from "next-mdx-remote/serialize";
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote";
import { Container } from "@styles/global.styles";
import fs from "fs";
import path from "path";
import matter from "gray-matter";
import BlogHeader from "@components/BlogHeader";
import BlogWrapper from "@components/BlogWrapper";
import hljs from "highlight.js";
import "highlight.js/styles/tomorrow-night-bright.css";

type Params = {
  [param: string]: any;
};

type ArticleProps = {
  source: MDXRemoteSerializeResult<Record<string, unknown>>;
};

export default function Article({
  source,
}: ArticleProps): InferGetStaticPropsType<typeof getStaticProps> {
  const {
    scope: { dateString, mainImageUrl, title, excerpt, longtimeRead, altImage },
  } = source;

  useEffect(() => {
    hljs.highlightAll();
  }, []);

  return (
    <Container>
      <BlogHeader
        altImage={altImage}
        longtimeRead={longtimeRead}
        excerpt={excerpt}
        title={title}
        dateString={dateString}
        mainImageUrl={mainImageUrl}
      />
      <BlogWrapper>
        <MDXRemote {...source} />
      </BlogWrapper>
    </Container>
  );
}

export const getStaticPaths: GetStaticPaths = async () => {
  const articleDirectory = path.join("__articles");
  const articleFiles = fs.readdirSync(articleDirectory);
  const paths = articleFiles.map((fileName: string) => ({
    params: {
      slug: fileName.replace(".mdx", ""),
    },
  }));

  return {
    paths,
    fallback: false,
  };
};

export const getStaticProps: GetStaticProps<Params> = async ({
  params: { slug },
}: Params) => {
  const articleFile = fs.readFileSync(path.join("__articles", slug + ".mdx"));
  const { data: metaData, content } = matter(articleFile);
  const mdxSource = await serialize(content, { scope: metaData });

  return { props: { source: mdxSource } };
};

If i’m comment all from module highlight.js its running. Any solutions?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
joshgoebelcommented, Feb 8, 2022

Closing as a dup of https://github.com/highlightjs/highlight.js/issues/3387. This is a #wontfix. Firefox 77/78 is over 1.5 years (18 releases!) old now and no longer supported by Highlight.js. You can read the other issue for more context.

1reaction
joshgoebelcommented, Mar 29, 2022

We also can’t suggest users run newer browsers.

While it may be impossible to guarantee I certainly don’t see why it couldn’t be at least suggested. A browser that is 18 releases behind on critical bugfixes and security updates is not a good thing in the world.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recent Difficulty with Google products using Firefox
I am using 77.0.1 (64-bit) on Mac OS - MoJave v10.14.5 - I do NOT experience these issues when using Chrome browser, or...
Read more >
Syntax error in regular expression (in v11.3.1) #3387 - GitHub
Build a version of Highlight.js without Python support. ... Syntax Error when load on Firefox Browser v.77.0.1 (64-bit) #3476.
Read more >
react 16: Uncaught (in promise) Error: Unexpected token u in ...
Just tested it on Firefox 77.0.1 (64-bit) and Brave version 1.9.80 Chromium: 81.0.4044.138 (Official Build) (64-bit) - no errors reported!
Read more >
Firefox version history - Wikipedia
Firefox was created by Dave Hyatt and Blake Ross as an experimental branch of the Mozilla browser, first released as Firefox 1.0 on...
Read more >
Mozilla Firefox 106.0.5 - freshcode.club
Firefox is a widely used web browser. It's based on Mozillas Gecko HTML rendering and IonMonkey JavaScript engine. It supports HTML5, XML, XHTML,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found