DEV Community

Rohit More
Rohit More

Posted on

ts file modules not loaded.

Hi,
I have upgraded my angular project to v12 to v13. I'm using webpack 5 (earlier it was v4). I have below entry for my main.ts is webpack.config file.

module.exports{
....
entry: {
main: "./js/main.js",
mainDrawer: "./js/divdrawer/main.ts",
},
}

main.ts

_import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { AppModule } from "./app.module";
import { SourceModule } from "./source.module";
import { GroupModule } from "./group.module";

window.appnamespace.platform = platformBrowserDynamic();
window.appnamespace.AppModule = AppModule;
window.appnamespace.SourceModule = SourceModule;
window.appnamespace.GroupModule = GroupModule;_


Problem is when I am using window.appnamespace.XXXXProperty it's showing me undefined.

Before v13 with webpack v5 it was working fine. Let me know the solution to resolve this.
Is this because of AOT compilation in angular 13? I was using JIT.
--Thanks

#angular #webpack

Top comments (0)