Skip to content

Orb tries to load worker file that doesn't exist [Angular] #94

@frne

Description

@frne

Context

Using Orb in an Angular 17 component:

export class ApplicationsComponent implements AfterViewInit {

  @ViewChild('graph')
  graphElement!: ElementRef<HTMLDivElement>;

  orbInstance!: Orb;

  reload() {
    this.orbInstance.data.setup({
      nodes: [
        {id: "foo", label: "Test App"}
      ],
      edges: []
    })

    this.orbInstance.view.render(() => {
      this.orbInstance.view.recenter();
    });
  }

  ngAfterViewInit(): void {
    this.orbInstance = new Orb<Node, Edge>(this.graphElement.nativeElement)
    this.reload();
  }
}

Problem

When constructing new Orb in ngAfterViewInit(), it tries to load a worker file using a GET call to the following URL:

http://localhost:8990/@fs/home/boss/Projects/rapid-arch/frontend/.angular/cache/17.2.2/vite/deps/process.worker?type=module&worker_file

The following error occurs:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Question

It seems that Orb is trying to load a webworker or similar, but this URL doesn't exist (content of index.html is returned). Is it possible to preload the worker or supply it under a different path? Is there any configuration to change or deactivate this behavior? If not, can it be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions