2017-04-19 66 views
0

我有我的Grails 3应用程序。我已将我的前端应用程序(使用Angular 2.1构建)放入src/main/webapp文件夹中。Grails 3应用程序无法加载* .js文件

在加载URL http://localhost:8080/的应用程序时,我将它重定向到Index.html页面。

但index.html页面没有加载

网址: - http://localhost:8080/static/app-name/index.html

而且我得到以下错误控制台。

GET http://localhost:8080/inline.js 的index.html:14

GET http://localhost:8080/main.78fb007fcde8966a4e95.bundle.js 的index.html:14

GET http://localhost:8080/styles.d63e17da56bb3a1ca523.bundle.js 的index.html:14

GET http://localhost:8080/main.78fb007fcde8966a4e95.bundle.js 404()

+0

您是否正在使用默认资产管道?如果是这样,你应该把你的JavaScript文件放在:grails-app/assets/javascripts中,然后用g:asset标签嵌入它们。 –

回答

0

改变它,以便资源没有得到来自/static网址服务:

application.yml

grails: 
    resources: 
     pattern: /** 
+0

进行此更改后,我不需要静态,但我仍然面临相同的404问题。 – JavaAppUser

0

最后,我得到了解决。

1)复制DIST内容,而不是DIST夹itslef成的src /主/ web应用

2.)制造application.yml的变化通过@詹姆斯所建议的Kleeh。

3.)将控制器uri重新路由到index.html。

然后就这样了。

PS:我实际上面临的路径问题,已经解决以上步骤