1

我正在构建一个 grails 应用程序,它使用来自依赖项的资产,就好像它们在我自己的项目中一样。在开发模式下运行应用程序工作正常,因为没有文件被丑化/缩小。但是,当为生产构建对文件进行预处理时,会出现错误,因为处理器找不到它们。

您可以在assetCompile 任务的输出中看到它:

:assetCompile
...
Unable to Locate Asset: /spring-websocket.js
Unable to Locate Asset: /spring-websocket
Uglifying File 18 of 28 - application
Compressing File 18 of 28 - application
Processing File 19 of 28 - jquery-2.1.3.js
Uglifying File 19 of 28 - jquery-2.1.3
Compressing File 19 of 28 - jquery-2.1.3
Processing File 20 of 28 - my-websocket.js
Unable to Locate Asset: /spring-websocket
Uglifying File 20 of 28 - my-websocket
Compressing File 20 of 28 - my-websocket
...
Processing File 26 of 28 - sockjs.js
Uglifying File 26 of 28 - sockjs
Compressing File 26 of 28 - sockjs
Processing File 27 of 28 - spring-websocket.js
Unable to Locate Asset: /sockjs
Unable to Locate Asset: /stomp
Uglifying File 27 of 28 - spring-websocket
Compressing File 27 of 28 - spring-websocket
Processing File 28 of 28 - stomp.js
Uglifying File 28 of 28 - stomp
Compressing File 28 of 28 - stomp
Finished Precompiling Assets

所需的资产与 spring-websocket(sock.js 和 stomp.js)捆绑在一起。您可以看到预编译器抱怨它们,但最终最终找到它们。这些单独的文件进入最终的 .war,但没有进入包含我的依赖代码的缩小的 application.js。资产管道有办法解决这个问题吗?

4

0 回答 0