load remote url in angular route loadchildren

598 Views Asked by At

I am trying to load a lazy-loaded application from a server

localhost://4600

inside a client application

localhost://3000

as an angular-element using ngx-build-plus, but when I load the angular element it fetches chunks using the client url(localhost://3000) instead of the server url. is it possible to fetch the chunk files from the server((localhost://4600) the code in the server

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

There are 1 best solutions below

0
On

for those facing similar issue webpack publicPath was able to solve this for me. the below code was added to my webpack file

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

for more info on publicPath