gpujs / gpu.js

GPU Accelerated JavaScript
https://gpu.rocks
MIT License
15.1k stars 652 forks source link

Node.js netlify build: Uncaught Error: this.name could not be set gpu-browser.js:7249 #649

Closed joshbrew closed 3 years ago

joshbrew commented 3 years ago

Hey there, I have gpu.js working successfully in a little free nodejs typescript progressive web app I'm working on.

You can see the source code here: https://github.com/moothyknight/eegpwa

And you can see the netlify build attempt here (error in console): https://webbci.netlify.app

I am getting this error on netlify using gpujs, this does not happen on the local build and works like a charm otherwise:

Uncaught Error: this.name could not be set
    at n.value (gpu-browser.js:7249)
    at new e (gpu-browser.js:7234)
    at n.<anonymous> (gpu-browser.js:14)
    at new n (gpu-browser.js:11915)
    at n.<anonymous> (gpu-browser.js:14)
    at new n (gpu-browser.js:16595)
    at gpu-browser.js:6773
    at Array.map (<anonymous>)
    at Function.value (gpu-browser.js:6773)
    at n.value (gpu-browser.js:17642)

and I am able to create kernels in the console on the netlify link that run, so this tells me it's probably something in my definitions that are not carrying into netlify correctly. Anybody know what could be the issue? You can probe how I set up the gpujs calls here: https://github.com/moothyknight/eegpwa/blob/main/src/js/utils/gpuUtils.js

Again, no issues locally

robertleeplummerjr commented 3 years ago

This source, from one of your auxiliary functions, is being minified and is loosing the function's name: function(t,e){return t+e}. We currently only support named functions. Is there a means of referencing it perhaps? If you are including the function inline, perhaps you could separate them, so you have to pass it by reference to its name.

joshbrew commented 3 years ago

Fixed it! Thanks! Check the webbci link out

robertleeplummerjr commented 3 years ago

Wow! Fantastic.