【发布时间】:2018-06-17 20:45:31
【问题描述】:
我正在尝试使用 react-redux 为应用程序实现服务器端渲染,并为服务器提供 express,正在使用 webpack 创建包。
我开始使用以下文档:
https://redux.js.org/docs/recipes/ServerRendering.html
我有以下设置来加载从 webpack 创建的 main.js:
<script type="application/javascript" src="/static/main.js"></script>
不过,在启动 express 服务器时,这是我在控制台中看到的:
Refused to execute script from 'http://localhost:8080/static/main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
这不会在任何浏览器中启动。知道会发生什么吗?
【问题讨论】:
-
该文件是否存在于该位置(localhost:8080/static/main.js)?
标签: javascript express react-redux server-side-rendering serverside-javascript