reactjs - 运行 gzipped react 代码给出错误“Uncaught SyntaxError: Unexpected token '<”
问题描述
我在 create-react-app 模板上创建了一个应用程序,并在 package.json 的 script 标签下添加了这个命令。
"postbuild": "find ./build -type f \\( -name \\*.js -o -name \\*.css \\) -exec gzip {} \\;"
我可以看到在build/static/js中创建了 gzipped js 文件。
现在,当我尝试使用serve -s build
运行我的构建代码时,Uncaught SyntaxError: Unexpected token '<
出现错误。
解决方案
推荐阅读
- ios - 如何在多个 .xcassets 文件之间切换
- wordpress - 联系人 7 表单字段在 Safari 中不起作用
- architecture - 根据 Clean Architecture,SNS 上不存在实体且仅存在用例?
- highcharts - 如何使 Highcharts 中饼图的连接器(连接数据标签的线)看起来是直线而不是弯曲的?
- angular - Azure 应用服务中的 Dotnet 发布错误 - 错误:找不到模块“@angular/core”
- babeljs - 如何在非nodejs环境/没有npm的情况下配置babel?
- unix - 仅从 csv 文件中获取重复项
- python - CNN 多输入,检查模型输入时出错:预计会看到 2 个数组,但得到了以下 1 个数组的列表:
- sql - 与 Oracle 部分匹配
- ios - 如何使可点击的 NSAttributedString 移动到另一个 ViewController Swift