single-spa / single-spa-angular

Helpers for building single-spa applications which use Angular
Apache License 2.0
195 stars 77 forks source link

Problem starting angular app #517

Open mgg709 opened 1 month ago

mgg709 commented 1 month ago

Demonstration

Expected Behavior

When I run the command npm run serve:single-spa:menu I want my app to start working but I get the following errors

Actual Behavior

When I run the command npm run serve:single-spa:menu I get the following errors:

`./src/main.single-spa.ts:4:0-45 - Error: Module not found: Error: Can't resolve './app/app.module' in 'C:\Repositorios\micro-frontends\menu\src'

./src/main.single-spa.ts:5:0-57 - Error: Module not found: Error: Can't resolve './environments/environment' in 'C:\Repositorios\micro-frontends\menu\src'

Error: src/main.single-spa.ts:7:27 - error TS2307: Cannot find module './app/app.module' or its corresponding type declarations.

7 import { AppModule } from './app/app.module';



Error: src/main.single-spa.ts:8:29 - error TS2307: Cannot find module './environments/environment' or its corresponding type declarations.

8 import { environment } from './environments/environment';
`

My main.single-spa.ts:

`

import { enableProdMode, NgZone } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { singleSpaAngular } from 'single-spa-angular';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { singleSpaPropsSubject } from './single-spa/single-spa-props';

if (environment.production) {
  enableProdMode();
}

const lifecycles = singleSpaAngular({
  bootstrapFunction: singleSpaProps => {
    singleSpaPropsSubject.next(singleSpaProps);
    return platformBrowserDynamic().bootstrapModule(AppModule);
  },
  template: '<app-root />',
  NgZone,
});

export const bootstrap = lifecycles.bootstrap;
export const mount = lifecycles.mount;
export const unmount = lifecycles.unmount;
`

I'm using the single-spa framework and I have simply created an angular app following the steps that come out of the terminal
mgg709 commented 1 month ago

Also I have another question, How can I specify the version of Angular when installing it using the default steps through the terminal?

claudiomerli commented 1 week ago

Seems schematics actually doesn't support Angular 18