Skip to content

WebGPURenderer's Matrix4 side-effects break tree-shaking and WebGLRenderer #23372

@CodyJasonBennett

Description

@CodyJasonBennett

WebGPURenderer has side-effects that directly modify THREE.Matrix4 that were introduced in #20283. This is a bit problematic since those side-effects can't be tree-shaken, and they will bundle alongside threejs in client/server bundles (these can be code-split to be imported from multiple pages/bundles). This can break apps that utilize both WebGLRenderer and WebGPURenderer (like a blog or somewhere you'd have a lot of demos).

I discovered this by importing a flatbundle of three/examples/jsm (from #23368) but you can reproduce by importing the renderer individually:

import { WebGPURenderer } from 'three/examples/jsm/renderers/webgpu/WebGPURenderer'

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions