Syntax Error when load on Firefox Browser v.77.0.1 (64-bit)
See original GitHub issueHello 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
On console
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:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.