1

I am working on a monorepository that houses multiple angular (v7) applications.

Angular AOT compilation with webpack gives me trouble.

The top-level structure looks like this:

  • application 01
    • node_modules
    • src
  • application 02
    • node_modules
    • src
  • ...
  • shared
    • node_modules
    • src

All application can use code from the shared folder. Everything works perfectly until AngularCompilerPlugin's second compilation phase is run.

It throws errors like:

Module not found: Error: Can't resolve '../../../../../../../Shared/node_modules/@angular/material/button/typings/index.ngfactory'

Components and services from the shared folder seem not to be created and/or included in the compilation.

Has anyone stumbled over a similar issue?

Is it possible to make the AngularCompilerPlugin included factory files from multiple source directories?

Thank you for you help.

David Brem
  • 504
  • 2
  • 6
  • 16

1 Answers1

2

i have only one node_module folder on project with same structure. I use nrwl/nx for more workspaces.

See it on github

My structure:

apps
  - app1
     - src
  - app2
     - src
libs
  - shared1
     - src
  - shared2
     - src
node_modules

Why you need more node_modules?

ErikHer
  • 227
  • 2
  • 5
  • 12
  • Thank you for your answer @ErikHer. Maybe the structure you suggested would be better. I will definitely consider it. However, since everything works fine when compiling the thing without AOT, I would still like to understand how to use AngularCompilerPlugin for my particular setup. – David Brem Jun 04 '19 at 11:49