Kitware / vtk-js

Visualization Toolkit for the Web
https://kitware.github.io/vtk-js/
BSD 3-Clause "New" or "Revised" License
1.23k stars 370 forks source link

Hardware selector error on master #1862

Closed laurennlam closed 3 years ago

laurennlam commented 3 years ago

Describe the bug

I updated my code from a master commit dated from last week to master(303a53380f30ff0a28323d064e7299e2ecf4726f), and my code is now broken. My guess is that it's link to this MR. Maybe I have to updated my code but I need some help.

Code

        this.renderWindow = vtkRenderWindow.newInstance();
        this.renderer = vtkRenderer.newInstance();

        this.renderWindow.addRenderer(this.renderer);
        this.openglRenderWindow = vtkOpenGLRenderWindow.newInstance();

Screenshots

error

Platform:

Device:

Browsers Affected:

vtk.js version: https://github.com/laurennlam/vtk-js/tree/add-obbtree rebase on master (last commit 303a53380f30ff0a28323d064e7299e2ecf4726f)

@martinken @jourdain

laurennlam commented 3 years ago

Here is what I tried without success:

        this.renderWindow = vtkRenderWindow.newInstance();
        this.renderer = vtkRenderer.newInstance();

        this.renderWindow.addRenderer(this.renderer);
        this.openglRenderWindow = this.renderWindow.newAPISpecificView();
martinken commented 3 years ago

Looks like some sort of babel issue @jourdain will likely know more. Maybe babel needs another package (although my tests all work fine locally) etc.

laurennlam commented 3 years ago

Here are the packages I used in my project:

    "devDependencies": {
        "@babel/core": "7.9.6",
        "autoprefixer": "9.8.0",
        "babel-loader": "8.1.0",
        "blueimp-md5": "2.16.0",
        "gl-matrix": "3.1.0",
        "jquery": "^3.6.0",
        "jszip": "3.4.0",
        "kw-web-suite": "10.0.0",
        "mobile-detect": "^1.4.5",
        "seedrandom": "3.0.5",
        "shader-loader": "^1.3.1",
        "webpack": "^2.2.1",
        "webpack-dev-server": "^2.4.1",
        "webvr-polyfill": "0.10.12",
        "worker-loader": "^2.0.0"
    }
jourdain commented 3 years ago

With the latest vtk.js you should not need kw-web-suite anymore. By having it up, you may trigger some module resolution conflict.

(I'm not saying that is the issue, but at least you should not have it anymore)

jourdain commented 3 years ago

Also all your build dependencies are getting old and therefore don't really support async/await.

You can see that vtk.js is using Webpack 5.x while you are still on version 2.x.

https://github.com/Kitware/vtk-js/blob/master/package.json

jourdain commented 3 years ago

In case you don't want to deal with vtk.js transpiler rules and so on, you can use the esm build of vtk.js under @kitware/vtk.js.

laurennlam commented 3 years ago

Thanks. I'll tested it and let you know if it fixes the issue.

jourdain commented 3 years ago

If this is still an issue, please re-open.

laurennlam commented 3 years ago

I didn't manage to fix it for now. But probably because of my webpack config. I'll reopen if I still have the issue. Thanks !