Search code examples
next.jsbuild

NextJS when parsing emoji/spacial char build crash using "export" script


I have a simple NextJs app.

When I'm running the app on a localhost everything seems to work fine - The code complied successfully with no errors.

When I use this script: next build && next export and browse to my local build, The browser load only my html file (without any css files), and I received the following error:

  1. The stylesheet https://my-app/_next/static/css/b5fa8f67lb08ea0a.css was not loaded because its MINE type, "text/html", is not "text/css"

  2. Uncaught SyntaxError: expected expression, got '<'

The code that causes the error:

import React from 'react';

const Main = () => {
    return (
        <div>
          <iframe src="https://dummy-demo" 
             title="▶My Demo"
          />
        </div>
}

When I removed the "▶" char the error disappeared and the application complied successfully.

I would like to know the reasons for the error and any alternative ways to compile successfully "special" chars while using next build && next export scripts


Solution

  • Have you tried to replace by it’s numeric character reference: &#9654; ?