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

Examples: Use import maps polyfill #23163

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Examples: Use import maps polyfill #23163

merged 1 commit into from
Jan 6, 2022

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Jan 6, 2022

Related issue: #23148

@mrdoob mrdoob added this to the r137 milestone Jan 6, 2022
@mrdoob mrdoob merged commit a2955f0 into dev Jan 6, 2022
@mrdoob mrdoob deleted the importmaps branch January 6, 2022 22:59
@mrdoob
Copy link
Owner Author

mrdoob commented Jan 6, 2022

@sunag should I revert #22936?

@sunag
Copy link
Collaborator

sunag commented Jan 7, 2022

Hmm... In case of revert we should be add this polyfill to NodeMaterial/WebGL examples too...
It's ok for me.

@mrdoob
Copy link
Owner Author

mrdoob commented Jan 12, 2022

@sunag Could you take care of that?

@sunag
Copy link
Collaborator

sunag commented Jan 13, 2022

Should we have something like three-nodes?

{
	"imports": {
		"three": "../build/three.module.js",
		"three-nodes": "../jsm/renderers/nodes/Nodes.js"
	}
}

@mrdoob
Copy link
Owner Author

mrdoob commented Jan 13, 2022

Hmm, right now three is also a npm package...
If we did this, people would expect three-nodes to be a npm package too. Is that something we want to do?

@sunag
Copy link
Collaborator

sunag commented Jan 29, 2022

If we did this, people would expect three-nodes to be a npm package too. Is that something we want to do?

@mrdoob I think in something like this:
#23368 (comment)

@mrdoob
Copy link
Owner Author

mrdoob commented Jan 31, 2022

Yesterday I registered the package just in case 😀
https://www.npmjs.com/package/three-nodes

@mrdoob
Copy link
Owner Author

mrdoob commented Jan 31, 2022

@marcofugaro Is there a way of publishing multiple packages from the same package.json/repo? We may need to move three-nodes to its own repo in https://github.com/threejs/ otherwise..

@marcofugaro
Copy link
Contributor

@marcofugaro Is there a way of publishing multiple packages from the same package.json/repo?

Not with plain npm, but there are some tools/scripts.

@mrdoob what do you think about this aliasing instead? This way we don't have to publish a new package.

import { ArrayInputNode } from 'three/nodes'

@unphased
Copy link
Contributor

unphased commented Apr 10, 2022

Hi, the import maps polyfill/shim is preventing Safari from being able to run app code if dev tools are open, so there would be no way to use dev tools to work on safari-specific issues with three.js apps. Are we aware of the issue? I'll also follow up at https://github.com/guybedford/es-module-shims.

@marcofugaro
Copy link
Contributor

@unphased no issues for me in safari devtools, are you sure this isn't caused by some other part of your application?

image

@unphased
Copy link
Contributor

unphased commented Apr 10, 2022

If you reload while the dev tools window is open, does the 3d scene load at all for you?

@marcofugaro
Copy link
Contributor

Yup, all normal.

@unphased
Copy link
Contributor

unphased commented Apr 10, 2022

Yup, all normal.

Thanks for confirming. So, you still get the error TypeError: Module specifier, 'application' does not start with "/", "./", or "../"., but with dev tools open and reloading on the examples page the scene loads for you. This is not what I experience on my M1 Max, but I will check on my Intel Macs (and with dev tools connected to mobile safari)

@unphased
Copy link
Contributor

Ok so I wasn't accounting for the slower execution speed when devtools are open. the Threejs examples do work as you say, sorry about that.

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

Successfully merging this pull request may close these issues.

4 participants