Bob5421
Bob5421

Reputation: 9093

Differences between app.shared.module.ts and app.server.module.ts

I am working on an asp.net core 2.0 mvc with angular project. I have created a fresh project from official template;

I can see 2 files in ClientApp subfolder and i do not understand the differences between those 2 files:

app.shared.module.ts
app.server.module.ts

Thanks

Upvotes: 3

Views: 1232

Answers (1)

zanther
zanther

Reputation: 529

Check out this answer, as I believe it applies to you:

The ASP.NET Core SPA with Angular 4 template splits the AppModule into three files so that Webpack will be able to efficiently compile the client-side bundle (suitable for running in browsers) and the server-side prerendering bundle (meant for running in Node).

More specifically, such approach expects that:

  • browser-specific modules and providers will be put in the app.module.browser.ts file.
  • server-specific modules and providers will be put in the app.module.server.ts file.
  • anything needed regardless of the executing context will be put in the app.module.shared.ts file.

Upvotes: 1

Related Questions