getViewport is not a function error in Chrome

I’m using latest three:
npm info three
latest: 0.118.3

my runtime check with ‘globalPackageVersion’ also says I’m using this version.
I look into node_modules/three/src/renderers/WebGLRenderer.js and I see
the there is function ‘this.getViewport = function…’

my VisualStudio Code editor is happy with my Typescript module code:


Yet, when I run this webpack’ed code in Chrome I get ‘is not function error’ on that line.
And indeed in Chrome debugger I see that there is no getViewport().

What am I doing wrong?

Any chances to demonstrate the issue with a live example?

That would be challenging. I mean the code is mostly open source (OpenWebCAD) and I don’t mind sharing my feeble efforts but it is not like installing it would be trivial for anyone who would like to try it.

Or, I don’t know, I’m new to node.js so if I just stuff everything into a github project would that allow anyone easily try it out?

Definitely I must have some mix somewhere!

When I step into with debugger to WebGLRenderer.getSize I see

   this.getSize = function () {

			return {
				width: _width,
				height: _height


But VSC does not allow me to write getSize() instead it insists on getSize(target), which call ‘works’ but target is not set, obviously! cause at runtime getSize() function does take parameters…

So somehow threejs in Chrome is not what my VSC sees…

Well, this is definitely not the getSize() implementation of WebGLRenderer. Are you using one of the CSS renderers next to WebGLRenderer?

Thanks, must be something like that. This is foreign territory to me how can I tell? Where is that specified/controlled (CSS renderer) ? Like I implied this is not my code so I’ve not set up most of the stuff…

You seem to have an issue with bundling, not threejs. If you’d put your project on github it may be easier to tell what’s the problem (I’d guess you have one version on three locally, which VS Code reads, but you load a separate one via CDN. But it’s just a guess.)