问题描述
我使用react / rails部署带有AWS EC2实例的网站。 通过rails -e production运行服务器时 我收到此错误
Refused to execute script from 'http://<ip-address>/packs/js/index-662807e73049021453fe.js' because its MIME type ('text/html') is not executable,and strict MIME type checking is enabled.
我的application.erb.html
<!DOCTYPE html>
<html>
<head>
<title>Production server</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<%= stylesheet_link_tag 'application',media: 'all','data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application','data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'index' %>
</head>
<body>
<%= yield %>
</body>
</html>
我已经在寻找答案一个星期了。 任何帮助将不胜感激。
更新:
我的路线以捕获route.rb中的所有路线
root 'homepage#index'
get ':path',to: 'homepage#index',format: false
这指向主页视图
<%= javascript_pack_tag 'index' %>
<%= react_component("App",{prerender: true}) %>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)