React 路由器中断 index.html 个脚本

React router breaks index.html scripts

当我进入反应路由器 index.html 的子目录下时,链接和脚本无法加载。

:1 Refused to apply style from 'http://localhost:3000/solutions/css/default.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

当我在 /foo 路线时,它很好..但是当我进入 /foo/foo 时,我得到这个错误。例如这条路线是/solutions/home。在控制台错误中,它到达 /solutions,然后从那里尝试从 index.html.. 导入 scrs。我错过了什么吗?

index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" sizes="16x16" />
    <meta
      name="viewport"
      content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <meta name="theme-color" content="#000000" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link rel="stylesheet" href="css/default.css" />
    <link rel="stylesheet" href="css/component.css" />
    <title>Neuroelectrics</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>

  </body>
</html>

这是一个简单的过程..在思考并尝试调试了很多关于 React 和 React 路由器之后,我意识到它没有什么(愚蠢),只是将 %PUBLIC_URL% 添加到所有链接文件。问题是 react router index.html 试图在路由器路由下获取这些文件。