Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which part files exactly be exclude to avoid this compilation error? #1497

Open
SamanFekri opened this issue Mar 29, 2022 · 9 comments
Open
Assignees
Labels
status: reproduction needed 🔁 Reproduction of described behaviour needed by core team type: bug 🐛 Something isn't working

Comments

@SamanFekri
Copy link

When I make a new CustomFormInput in admin-ui and want to comiple the new js (from ts to js)
this error occurres. but if I use only ts the error doesn't occur

Error: src/shared-extensions.module.ts:10:14 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

which files must exactly exclude to avoid this error?

@SamanFekri SamanFekri added the type: bug 🐛 Something isn't working label Mar 29, 2022
@michaelbromley
Copy link
Member

Hi, can you share the contents of your shared-extensions.module.ts file?

@SamanFekri
Copy link
Author

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FacetValueFilteredFormInputModule } from './extensions/0e0807940b860314f1604289e954e12bb29478078aae08e504b357b0853bad49/facet-value-filtered-form-input.module';


@NgModule({
    imports: [CommonModule, FacetValueFilteredFormInputModule],
})
export class SharedExtensionsModule {}

@michaelbromley
Copy link
Member

ah ok thanks. So that's the one generated by the ui compiler. Now can you show the file containing the FacetValueFilteredFormInputModule?

@SamanFekri
Copy link
Author

this is FacetValueFilteredFormInputModule

import {NgModule} from "@angular/core";
import {registerFormInputComponent, SharedModule} from "@vendure/admin-ui/core";
import {FacetValueFormInputComponent} from "./facet-value-filtered-form-input.component";

@NgModule({
  imports: [SharedModule],
  declarations: [FacetValueFormInputComponent],
  providers: [
    registerFormInputComponent('facet-value-filtered-form-input', FacetValueFormInputComponent),
  ]
})
export class FacetValueFilteredFormInputModule {}

and this is FacetValueFormInputComponent

// @ts-nocheck
import {ChangeDetectionStrategy, Component, Input, OnInit} from "@angular/core";
import { FormControl } from '@angular/forms';
import {CustomFieldControl, DataService, FormInputComponent, InputComponentConfig, FacetWithValuesFragment} from '@vendure/admin-ui/core';
import { Observable } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
import { switchMap, shareReplay } from 'rxjs/operators';


@Component({
  selector: 'facet-value-filtered-form-input',
  template: `
      <vdr-facet-value-selector
              *ngIf="facets$ | async as facets"
              [readonly]="readonly"
              [facets]="facets"
              [formControl]="formControl"
      ></vdr-facet-value-selector>
    `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FacetValueFormInputComponent implements OnInit, FormInputComponent {
  static readonly id = 'facet-value-filtered-form-input';
  readonly isListInput = true;
  readonly: boolean;
  formControl: FormControl;
  facets$: Observable<FacetWithValuesFragment[]>;
  config: InputComponentConfig;

  constructor(private dataService: DataService) {}

  ngOnInit(): void {
    this.facets$ = this.dataService.facet
      .getAllFacets()
      .mapSingle(data => {
        console.log(this.config?.ui?.code)
        if(!this.config?.ui?.code || this.config?.ui?.code == '') {
          return data.facets.items
        }
        for(let i =0; i < data.facets.items.length; i++) {
          if(data.facets.items[i].code === this.config.ui.code) {
            return [data.facets.items[i]]
          }
        }
      })
      .pipe(shareReplay(1));
  }

}

@michaelbromley
Copy link
Member

Thanks. That looks ok. In the compiled admin-ui directory that gets generated by compileUiExtensions(), are there any .js files?

@SamanFekri
Copy link
Author

no there is not but it creates a dist directory and many things there are .js

@michaelbromley
Copy link
Member

That's expected - that's the final output of the Angular compiler which will run in the browser.

OK I think to help further, I'd need to look at a repo with a minimal reproduction of this issue. Then I can actually observe what is going on and debug properly. If you can put that together and share it here I'll take a look.

@SamanFekri
Copy link
Author

and when I use yarn start it will not create the admin-ui in the server

@martijnvdbrug
Copy link
Collaborator

@SamanFekri Are you still experiencing this issue? If so, can you supply a repo or code with a minimal reproduction of the error?

@martijnvdbrug martijnvdbrug added the status: reproduction needed 🔁 Reproduction of described behaviour needed by core team label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: reproduction needed 🔁 Reproduction of described behaviour needed by core team type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants