angular CLI,将 /wwwroot 添加到 ng build 上的索引 js 脚本 url

angular CLI, add /wwwroot to Index js scripts urls on ng build

我们在 asp.net 核心中有一个 angular 2 的应用程序,它 运行 在 Azure Service Fabric 集群中,我们遇到的小问题是当您 运行 ng 构建,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>

即在URL

中添加“/Meteoro/Meteoro.UI/{file}.js”

谢谢

您可以在 angular-cli.json

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

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

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