vtkImageStream.newInstance(): global is not defined

Hello all,

I am starting an angular app from scratch. I am taking Paraview-lite as a reference.

I am getting a reference error when just instantiating vtkImageStream.newInstance().

Can you help me understanding what I am doing wrong? Do I have to import another module as well?

So basically my code is doing this:

import vtkImageStream from ‘vtk.js/Sources/IO/Core/ImageStream’;

this.imageStream = vtkImageStream.newInstance();

and I am getting this error:

macro.js:35 Uncaught ReferenceError: global is not defined
at Module…/node_modules/vtk.js/Sources/macro.js (macro.js:35)
at webpack_require (bootstrap:78)
at Module…/node_modules/vtk.js/Sources/IO/Core/ImageStream/index.js (index.js:1)
at webpack_require (bootstrap:78)
at Module…/src/app/commands/commands.component.ts (main.js:201)
at webpack_require (bootstrap:78)
at Module…/src/app/app.module.ts (app.component.ts:8)
at webpack_require (bootstrap:78)
at Module…/src/main.ts (main.ts:1)
at webpack_require (bootstrap:78)

Francesc

Any update on this doubt/problem?

Thanks,

Francesc

I believe this is due to the NewInstance logic being removed a while ago. You should just be able to call ::New() or use the type constructor, though I’m not sure how the Emscripten build actually works in practice.

@ben.boeckel this is vtk.js not C++.

This is a build issue within angular.