当 Web 服务器应用程序在伞式应用程序中时,通过 Brunch 导入 Phoenix Socket、Phoenix HTML JS 模块

Import Phoenix Socket, Phoenix HTML JS Modules via Brunch when web server application is in an umbrella app

当 Phoenix Web 服务器不在 umbrella 应用程序中时,Brunch 会在 "deps/phoenix/web/static/js/socket""deps/phoenix_html/web/static/js/phoenix_html" 中找到模块,因为 phoenix 依赖项已安装到相对于 brunch 配置文件的位置。

在 Umbrella 应用程序中时,依赖项安装在 umbrella 应用程序本身,而不是网络服务器应用程序中。所以他们在 "../../deps/phoenix/web/static/js/" 而不是。

我尝试将 "../.." 添加到 brunch 配置文件和导入语句中的位置,但我无法让 Brunch 实际找到这些文件。

您需要配置 brunch 配置以指向正确的目录:

watched: ["../../deps/phoenix/web/static",
          "../../deps/phoenix_html/web/static",
          "web/static", "test/static"],

然后导入:

import "../../../deps/phoenix_html/web/static/js/phoenix_html"

我们应该修复 Phoenix,使其默认在雨伞内生成。