Search code examples
microservicesjhipster

Cannot find module '@angular-architects/module-federation/webpack'


I'm new to JHipster and using current version (8.1.0 latest till date) to create microservice app with JHipster registry and Angular microfrontend. After creation, when I try to start it (with mvnw command on Windows cmd), the build fails stating:
Cannot find module '@angular-architects/module-federation/webpack' in few of the files as shown in the attached screenshot. Build failure screenshot

My JHipster Registry service is up and running fine (before starting microservice app). Also, I'm using latest version of npm (9.8.1) and node (20.10.0). Attaching the input parameters I've used while creating the app. Input parameters screenshot

Please help me understand where I went wrong (or) how to resolve it.


Solution

  • There is a bug in v8.1.0 and should be fixed in next release.

    About workspaces/monorepository options

    Workspaces option uses npm scripts designed to match monolith applications so we can use common ci scripts.

    The problem happens because there is no way to create npm scripts without making it a workspaces root.

    Project structure with workspaces:
    /package.json
    /package-lock.json
    /microservice-1/package.json
    /microservice-2/package.json

    Project structure without workspaces:
    /microservice-1/package.json
    /microservice-1/package-lock.json
    /microservice-2/package.json
    /microservice-2/package-lock.json

    If you try to mix both structures it will have unknown results.

    Workspaces should be used in monorepositories only.