0

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

本地主机://4600

在客户端应用程序中

本地主机://3000

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

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

1 回答 1

0

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

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

有关publicPath的更多信息

于 2021-04-05T15:19:39.253 回答