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

r171 : Fn is not a function with vite. #29996

Open
Makio64 opened this issue Nov 29, 2024 · 4 comments
Open

r171 : Fn is not a function with vite. #29996

Makio64 opened this issue Nov 29, 2024 · 4 comments

Comments

@Makio64
Copy link
Contributor

Makio64 commented Nov 29, 2024

Description

import { Fn } from 'three/tsl' not working in r171

The requested module '/node_modules/.vite/deps/three_tsl.js?v=dde6d16d' does not provide an export named 'Fn' I saw similar problem last week when opening a bug in jsfiddle and using the dev branch.

Should we change our imports? @mrdoob

Reproduction steps

  1. try importing Fn

Code

X

Live example

https://jsfiddle.net/Makio64/m5zLofx2/1/

Screenshots

No response

Version

r171

Device

No response

Browser

No response

OS

No response

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 29, 2024

Your fiddle is not correct since the import map does not define three/tsl. When doing so, the import of Fn works as expected:

https://jsfiddle.net/a8xm3fph/5/

Maybe a Vite specific issue? The export in the npm package looks correct.

"./tsl": "./build/three.tsl.js"

@Spiri0
Copy link
Contributor

Spiri0 commented Dec 2, 2024

Fn is not part of three.module.js.
three.tsl.js imports "three/webgpu" at the beginning.
So without three.webgpu.js it doesn’t work.

I see Fn as part of three.webgpu.js with the ability to generate glsl code in fallback, but not as a tool intended for targeted shader generation in glsl with three.module.js.
In WebGL, in my opinion, it will be best to create shaders the old way, with RawShaderMaterial. The WebGL examples I looked at were left as they were, without Fn.
@Mugen87 please correct me if I'm wrong.

@Makio64
Copy link
Contributor Author

Makio64 commented Dec 2, 2024

Your fiddle is not correct since the import map does not define three/tsl. When doing so, the import of Fn works as expected:

https://jsfiddle.net/a8xm3fph/5/

Maybe a Vite specific issue? The export in the npm package looks correct.

"./tsl": "./build/three.tsl.js"

Its the imports of the jsfiddle examples from the Bug Request.
I'm currently using in vite : 'three/tsl': 'three/webgpu' as suggested by @RenaudRohlinger and it worked well until the r171, why this change ?

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 2, 2024

Its the imports of the jsfiddle examples from the Bug Request.

Thanks for the heads up. I have updated the fiddles so the import maps reflect the changes of r171. 17c59b2

I'm currently using in vite : 'three/tsl': 'three/webgpu' as suggested by @RenaudRohlinger and it worked well until the r171, why this change ?

I guess you are referring to this setup, right?

#28650 (comment)

I'm not a vite user so hopefully @RenaudRohlinger can help.

@Mugen87 Mugen87 changed the title r171 : Fn is not a function r171 : Fn is not a function with vite. Dec 2, 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

3 participants