0

In this answer it's been stated that platform-browser is for AOT compilation, and platform-browser-dynamic is for JIT compilation.

We're trying to use Angular in our own architecture using UMD module definitions.

Because size of the bundle files matter, we want to make sure we only include and bundle those libraries that are required.

Do we still need platform-browser if we use platform-browser-dynamic?

1 Answers1

0

There will no effect on bundle size. Angular creates bundle based on requirement. If you are using lazy loading then your subsequent module will not bundle in initial. Bundling of javascript is different from compilation of code. Angular compiles your all code and bundle them according to your code written.

When you run ng build --prod then angular compiles every module module, component, template (HTML view). Angular creates so many bundle (chunk) files if your are using lazy loading. Every module will bundle in its own bundle file.

If you will use platform-broswer the templates will precompile and if yiou will use platform-browser-dynamic then templated will compile on the fly and will increase slightly the size of bundle. If your application heavily using Angular codes in your templates then go with platform-broswer otherwise platform-broswer-dynamic will be good.

Hope it will help

Sandip Jaiswal
  • 3,428
  • 2
  • 13
  • 15
  • 1
    Thanks for your answer, but it didn't help at all. The question was very simple. I'm not using Angular CLI. I'm using UMD files. I just want to know if it's OK to only have `platform-browser-dynamic` on the client side, without having `platform-browser`. – mohammad rostami siahgeli Jan 08 '18 at 11:31