【问题标题】:load remote url in angular route loadchildren在角度路由 loadchildren 中加载远程 url
【发布时间】:2021-07-01 06:34:20
【问题描述】:

我正在尝试从服务器加载延迟加载的应用程序

本地主机://4600

在客户端应用程序中

本地主机://3000

使用 ngx-build-plus 作为 angular-element,但是当我加载 angular 元素时,它使用客户端 url(localhost://3000) 而不是服务器 url 获取块。是否可以从服务器获取块文件((本地主机://4600) 服务器中的代码

{
path: 'settings',
loadChildren: async () => import('./settings/settings.module').then(m => m.SettingsModule)
}

【问题讨论】:

    标签: angular angular-router angular-elements ngx-build-plus


    【解决方案1】:

    对于那些面临类似问题的人,webpack publicPath 能够为我解决这个问题。 以下代码已添加到我的 webpack 文件中

    output: {
            publicPath: 'http://localhost:4600/',
            filename: "[name].[contenthash].bundle.js",
            chunkFilename: "[name].[contenthash].bundle.js"
        }
    

    有关publicPath的更多信息

    【讨论】:

      猜你喜欢
      • 2017-04-04
      • 2018-06-13
      • 2020-12-03
      • 2018-07-12
      • 2017-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多