Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import from three/webgpu incompatible with UltraHDRLoader #29028

Closed
Makio64 opened this issue Jul 31, 2024 · 1 comment
Closed

import from three/webgpu incompatible with UltraHDRLoader #29028

Makio64 opened this issue Jul 31, 2024 · 1 comment
Milestone

Comments

@Makio64
Copy link
Contributor

Makio64 commented Jul 31, 2024

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

@mrdoob mrdoob changed the title import from three/webgpu incompatible with UltraHDLoader import from three/webgpu incompatible with UltraHDRLoader Jul 31, 2024
@Makio64
Copy link
Contributor Author

Makio64 commented Jul 31, 2024

Found the solution for vite here : #28650 (comment)
then import from three is correctly remap to three/webgpu

@Makio64 Makio64 closed this as completed Jul 31, 2024
@Mugen87 Mugen87 added this to the r168 milestone Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants