当 bower_components 向上两级时如何调试 angular

How to debug angular when bower_components is two levels up

我将我的 bower_components 向上移动了两个级别以将其从我的项目中移出,远离源代码控制,因为它是一个构建工件,它不是我的源代码,也不是构建输出的一部分(我的构建输出将所有供应商 js 连接到 vendor.js,一个文件)。

所以我可以构建 find 并且它可以很好地创建我的 dist 文件夹;我成功了。

但是现在当我尝试在我的本地机器上进行调试时,index.html 正确指向所有 ../../artifacts/bower_components 脚本,但当它在网络服务器中运行。我猜是因为它们在网络根目录之上。

如何让网络服务器找到它们?

I moved my bower_components two levels up to get it out of my project, out of the way of source control because it's a build artifact

bower_components 向上移动一个级别,使其不在您的 app 文件中是合乎逻辑的。但是两级以上,所以它不是源代码控制。通过向忽略文件 .(git|svn|...)ignore

添加异常可以更好地处理这种情况

无论如何,根据您使用的服务器,您应该能够配置路由,这样服务器也可以为 bower_components 文件夹中的内容提供服务。这是 browsersync:

的示例
server: {
    baseDir: "app",
    routes: {
        "/bower_components": "bower_components"
    }
}

服务器提供 app 文件夹中的内容,并将 bower_components 文件夹的内容映射到路由 /bower_components

index.html 中的链接因此看起来像这样:

<script src="bower_components/angular/..."></script>

...即使 bower_componentsindex.html.

处于不同级别