React Router:拒绝执行脚本或样式

Min*_*ina 3 html javascript node.js reactjs react-router

当我浏览http://localhost:8080/create 时,它工作正常,但是当浏览http://localhost:8080/create/344http://localhost:8080/edit/224 时,我收到此错误:

拒绝应用来自“ http://localhost:8080/edit/dist/main.css ”的样式,因为它的 MIME 类型(“text/html”)不是受支持的样式表 MIME 类型,并且启用了严格的 MIME 检查。

2345:12 GET http://localhost:8080/edit/dist/bundle.js 404(未找到)345:1

拒绝执行来自“ http://localhost:8080/editt/dist/bundle.js ”的脚本,因为它的 MIME 类型(“text/html”)不可执行,并且启用了严格的 MIME 类型检查。

这是我的代码:

<BrowserRouter>
    <Switch>
        <Route exact={true} path="/" component={Dashboard} />
        <Route path="/edit/:id" component={EditPost}/>
        <Route path="/create" component={AddPost} />
        <Route component={NotFoundPage}/>
    </Switch>
</BrowserRouter>
Run Code Online (Sandbox Code Playgroud)

请检查此屏幕截图:

在此处输入图片说明

这是我的 webpack 配置文件:https : //pastebin.com/d5vx8niQ项目文件:https ://drive.google.com/file/d/1IYcuJTbklXYi53XvIcNRJtb-tLOO4g1j/view?usp = sharing

小智 6

<base href="/">在链接所有 css 文件之前添加index.html 头。(来源:https : //github.com/froala/angular-froala/issues/170