Skip to content

import from three/webgpu incompatible with UltraHDRLoader #29028

@Makio64

Description

@Makio64

Description

This is a larger problem but i take the UltraHDLoader case.

UltraHDLoader dependencies are from three
In r167 I replaced all my import from three to three/webgpu accessible build via the package.json
So i get logically WARNING: Multiple instances of Three.js being imported..

This problem is likely to happen on other class and the 'easy' solution under is not very elegant.

Reproduction steps

  1. import the UltraHDLoader in a project importing files from three/webgpu

Code

threejs package.json relevant part :

  "type": "module",
  "main": "./build/three.cjs",
  "module": "./build/three.module.js",
  "exports": {
    ".": {
      "import": "./build/three.module.js",
      "require": "./build/three.cjs"
    },
    "./examples/fonts/*": "./examples/fonts/*",
    "./examples/jsm/*": "./examples/jsm/*",
    "./addons": "./examples/jsm/Addons.js",
    "./addons/*": "./examples/jsm/*",
    "./src/*": "./src/*",
    "./webgpu": "./build/three.webgpu.js",
    "./tsl": "./build/three.webgpu.js"
  },

easy fix for this case, i duplicate the class and changed the import.. :

import {
	ClampToEdgeWrapping,
	DataTexture,
	DataUtils,
	FileLoader,
	HalfFloatType,
	LinearFilter,
	LinearMipMapLinearFilter,
	LinearSRGBColorSpace,
	Loader,
	RGBAFormat,
	UVMapping,
} from 'three/webgpu'

Live example

non relevant.

Screenshots

No response

Version

r167

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions