angular CLI,将/ wwwroot添加到ng build

时间:2017-11-07 12:40:02

标签: angular asp.net-core angular-cli azure-service-fabric

我们在asp.net核心内部有一个angular 2应用程序,它运行在Azure Service Fabric集群中,我们遇到的一个小问题是,当你运行ng build时,index.html文件带有以下引用:

<script type = "text/javascript" src = "inline.bundle.js"> </ script>
<script type = "text/javascript" src = "polyfills.bundle.js"> </ script>
<script type = "text/javascript" src = "styles.bundle.js"> </ script>
<script type = "text/javascript" src = "vendor.bundle.js"> </ script>
<script type = "text/javascript" src = "main.bundle.js"> </ script>

但我们需要它们如下:

<script type="text/javascript" src="/Meteoro/Meteoro.UI/inline.bundle.js">
</script>
<script type="text/javascript"src="/Meteoro/Meteoro.UI/polyfills.bundle.js"
</script>
<script type="text/javascript" src="/Meteoro/Meteoro.UI/styles.bundle.js">
</script>
<script type="text/javascript" src="/Meteoro/Meteoro.UI/vendor.bundle.js">
</script>
<script type="text/javascript" src="/Meteoro/Meteoro.UI/main.bundle.js">
</script>

即将“/Meteoro/Meteoro.UI/{file}.js”添加到网址

谢谢

1 个答案:

答案 0 :(得分:0)

您可以在angular-cli.json

中进行配置
"apps": [
    {
        "deployUrl": "/Meteoro/Meteoro.UI/"
    }
]

这会将该路径附加到index.html资源。或者,您可以将其添加到构建命令

ng build --deploy-url=/Meteoro/Meteoro.UI/