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

Can't run three.js basic example #468

Open
fedemarino31 opened this issue Nov 7, 2023 · 4 comments
Open

Can't run three.js basic example #468

fedemarino31 opened this issue Nov 7, 2023 · 4 comments

Comments

@fedemarino31
Copy link

I've just followed the tutorial for Three.js on
https://www.theatrejs.com/docs/latest/getting-started/with-three-js
And I'm getting the following error:
image
But the tutorial does not say you should import the "core"

Also on a separate project, I tried importing the core module on a basic three.js project without usign Webpack or Vite.
I just wanted to directly import the module using import maps
The key parts of the code are:

main.html

	<script type="importmap">
		{
		  "imports": {
			"three": "/node_modules/three/build/three.module.js",
			"three/addons/": "/node_modules/three/examples/jsm/",
			"@theatre/":"/node_modules/@theatre/"
		  }
		}
	</script>

main.js

import { getProject } from '@theatre/core'

and I'm getting this error

image

I also tried with

import { getProject } from '@theatre/core/dist/index.js'

But it does not seam to export "getProject"

image

any ideas?

I'm using version 0.7.0

@GhostCatcg
Copy link

No one can help you with this question, but theatre has its own case study, you can check his case study

@gong9
Copy link

gong9 commented Jan 2, 2024

Why, I think it's foolish to not even guarantee basic tutorials and allow this to happen

@GhostCatcg
Copy link

The way you import modules is not what the theaterjs tutorial document says. You can try vite or webpack. I think the author has limited maintenance time. If you think it is unreasonable, you can submit a commit.

Why, I think it's foolish to not even guarantee basic tutorials and allow this to happen

@gong9
Copy link

gong9 commented Jan 2, 2024

I just took a look at its code, and its studio sub package needs to go to the window to obtain the core package. Therefore, it is necessary to

import studio from '@theatre/studio'
import core from '@theatre/core'

window.__TheatreJS_CoreBundle = core
studio.initialize()

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