0

When we hit "ng build" while doing Angular build by default it bundles HTML with JS and gives us one physical JS unit file.

Is there a option in "ng build" by which i can say do not bundle the view with the JS ?

some thing like

ng build --exclude views

Note I'm aware i can do by using webpack but do not want to explore this route for now as i have a very big project made in Angular 2 and want to quickly migrate.

Akber Iqbal
  • 14,487
  • 12
  • 48
  • 70
Shivprasad Koirala
  • 27,644
  • 7
  • 84
  • 73

1 Answers1

0

There is no such flag (--exclude), however whether you gather all your views under one folder (e.g: views) and then in your tsconfig.app.json you add that folder to the exclude array, something like :

{
  "compilerOptions": {
    ...
  },
  "exclude": [
    "views"  
  ]
}

And I strongly discourage this approach for architecturing reasons, even it should work.

Or try instead:

  "exclude": [
    "**/*.component.html",
  ]
SeleM
  • 9,310
  • 5
  • 32
  • 51