4

i have project with many standelone angular application on it. Typical user case can be :

  • admin.ts
  • front.ts
  • dashboard.ts

Where each are angular app. To manage that, i have actually single webpack.config.js where i do all packaging stuff.

The issue come when i want to add AoT compilation. For that i use @ngtools/webpack where unfortunatly we have to hardcoded on our webpack configuration the entrypoint path like this :

  plugins: [
    new AngularCompilerPlugin({
      tsConfigPath: 'path/to/tsconfig.json',
      entryModule: 'path/to/app.module#AppModule',
      sourceMap: true
    })
  ]

as you can see here on the angular-cli issue tracker, they not have any plan to handle multiple entry modules.

Have you any magic trick to play around this limitation and still keep single compilation process ?

proof of concept is available on my github

Yanis-git
  • 7,737
  • 3
  • 24
  • 41
  • Dear @yanis-git did you find the magic trick? – Diego Nov 24 '19 at 10:36
  • i have found a way to play around @Diego if you have look on my repository, you will have runnable PoC where i boostrap different webpack configuration base on parameter. if you want i can improve my readme to detail step by step. – Yanis-git Nov 24 '19 at 11:17
  • No need to. I got it, it's perfectly clear. Thanks! – Diego Nov 24 '19 at 12:16

1 Answers1

0

I'd suggest checking out @angular-builders/custom-webpack

It extends @angular-devkit/build-angular but allows you to modify the webpack config. Allowing you to add other entry points, etc. It has fairly good documentation on how set it up.

  • 1
    Thanks you @Josh for your answer. I have already try this approch but i am facing design issue when i try to have AOT support. As you can see on my post, Angular need `AngularCompilerPlugin` object which provide entryModule. Plugins webpack section are shared for all webpack entrypoints. – Yanis-git Apr 17 '19 at 05:15