single-spa / single-spa-angular

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

Missing environment module from newly built angular application #475

Closed Deval99 closed 1 year ago

Deval99 commented 1 year ago

Error

./src/main.single-spa.ts:6:0-57 - Error: Module not found: Error: Can't resolve './environments/environment' in 'WORK_DIR/src'

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

12 import { environment } from './environments/environment';



Temporary solution

$ mkdir WORK_DIR/src/environment
$ code environment.ts

Edit environment.ts file 
`import { NgModule } from '@angular/core';

@NgModule({})
export class environment {
  static production = true/false;
}
`

**Steps to reproduce the error**

$ create-single-spa
Directory .
Select: single-spa application / parcel
Select: angular
Assign name
Add angular routing
Select SCSS
Allow installing single-spa-angular@8.0.0
Add angular routing
Select default port
$ //Go to application folder
$ npm start
filoxo commented 1 year ago

This seems more related to single-spa-angular as create-single-spa does not generate this environment file.

arturovt commented 1 year ago

Environments files are not generated anymore in newer Angular workspaces; this change was made in Angular CLI. single-spa-angular requires environment file to be present. We're not and shouldn't be responsible for creating them since this is complex (check if exists, create if doesn't, etc.).