【发布时间】:2016-08-06 13:02:39
【问题描述】:
当我使用grunt 运行serve 时,$locationProvider.html5Mode(true) 工作正常。
但不适用于grunt build 并在console 中显示错误unexpected syntax error <
【问题讨论】:
-
该错误可能意味着您正在从服务器请求 json 或 javascript 但正在返回一个 html 页面,这通常发生在打开 html5 模式并且您的 Web 服务器将所有 404 重定向到索引时.这可能是有道理的,因为在
grunt serve上,重定向到索引可能已打开,但无论您将其托管在什么位置,它都已打开。不幸的是,除非您向我们展示您的Gruntfile,否则我们无法判断grunt serve的作用。 -
@DanPantry: 谢谢你,我会检查一下是否可能
-
No.It's not working here is my grunt file。 jsfiddle.net/saqibrizwan/70wx2mfo
-
@DanPantry:检查我在此链接上上传的 grunt 文件jsfiddle.net/saqibrizwan/70wx2mfo
标签: angularjs gruntjs angular-ui-router yeoman-generator