在 Google Chrome 上加载我的网站时,我收到了一些类似于以下内容的警告:
DevTools failed to load SourceMap: Could not parse content for https://mywebsite.com/static/js/2.abcd1234.chunk.js.map: Unexpected token < in JSON at position 0
我的 web 应用程序是部署在 AWS Amplify 上的 React 应用程序 (create-react-app)。在本地运行应用程序时,我没有收到这些警告。我如何摆脱这些警告?
这是使用引起的问题react-router
使用 AWS 放大。看这个 github 问题 https://github.com/aws-amplify/amplify-cli/issues/1326#issuecomment-485923845。它建议在Rewrites and redirects
AWS Amplify 中的应用程序设置部分:
Source address:
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>
Target address:
/index.html
Type:
200 (Rewrite)
为了解决我的问题,我添加了map
对此正则表达式的扩展:
源码地址:
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map)$)([^.]+$)/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)