首页 > 解决方案 > _0 不是推送到生产时的函数错误

问题描述

我的网站在 localhost 中运行,但使用 netlify 和 vercel 时它不起作用。我设法找到了错误,它似乎与反应降价有关。如果我删除代码,我的网站会成功推送到 netlify 和 vercel。这是代码:

    <ReactMarkdown
        children={currentNote ? currentNote.description : ""}
        components={components}
      />

    
   const components: ReactMarkdownOptions["components"] = {
      code({ node, inline, className, children, ...props }) {
       const match = /language-(\w+)/.exec(className || "");

      return !inline && match ? (
      <SyntaxHighlighter
        style={a11yDark}
        language={match[1]}
        PreTag="div"
        showLineNumbers
        children={String(children).replace(/\n$/, "")}
        {...props}
      />
    ) : (
      <code className={className} {...props}>
        {children}
      </code>
    );
  },
};

标签: reactjstypescriptreact-markdown

解决方案


推荐阅读