2017-04-19 67 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:我實際上面臨的路徑問題,已經解決以上步驟