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

svelte aframe TypeError: Cannot read properties of undefined (reading 'constructor') #5428

Open
Sincenir opened this issue Jan 12, 2024 · 3 comments

Comments

@Sincenir
Copy link

When i use aframe combined with svelte, is seems that my svelte's render is faster that aframe's import, causing my browser to report an error.

error:TypeError: Cannot read properties of undefined (reading 'constructor')
image

code:

<script>
	import 'aframe';
	
	let box = '#4CC3D9';
	let sphere = '#EF2D5E';
	let cylinder = '#FFC65D';
</script>

<div class="controls">
	<label>
		<input type="color" bind:value={box}>	
		box
	</label>
	
	<label>
		<input type="color" bind:value={sphere}>	
		sphere
	</label>
	
	<label>
		<input type="color" bind:value={cylinder}>	
		cylinder
	</label>
</div>


<a-scene background="color: #FAFAFA">
	<a-box position="-1 0.5 -3" rotation="0 45 0" color={box} shadow></a-box>
	<a-sphere position="0 1.25 -5" radius="1.25" color={sphere} shadow></a-sphere>
	<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color={cylinder} shadow></a-cylinder>
	<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>
</a-scene>

<style>
	.controls {
		position: absolute;
		top: 1em;
		left: 1em;
		z-index: 2;
	}
	
	input {
		height: 2em;
	}
</style>
  • A-Frame Version: ^1.5.0
  • Platform / Device: chrome
  • Reproducible Code Snippet or URL: ..
@akhil888binoy
Copy link

I would like to work on this issue

@vincentfretin
Copy link
Contributor

I don't know anything about svelte, but these type of error is related to async loading aframe I'm sure. Async loading aframe is worked on in #5419.

@dmarcos
Copy link
Member

dmarcos commented Jan 12, 2024

@akhil888binoy this looks an svelte integration issue. if you are knowledgable on Svelte you might be able to educate on how to integrate svelte and A-Frame properly. Having a good canonical example we can point to would be really helpful

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

4 participants