JSFiddle - React, Tailwind, and code Playground

HTML

<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
    
<script type="importmap">
	{
		"imports": {
			"three": "https://unpkg.com/three/build/three.module.js"
		}
	}
</script>

CSS

body {
	  margin: 0;
}

JavaScript

import * as THREE from 'three';

// init

const factor = 1;
const aspect = window.innerWidth/ window.innerHeight;
const camera = new THREE.OrthographicCamera(
	(factor * aspect) / -2,
	(factor * aspect) / 2,
	factor / -2,
	factor / 2,
	0.1,
	1000
);
camera.position.z = 1;

const scene = new THREE.Scene();

const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
const material = new THREE.MeshNormalMaterial();

const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animation );
document.body.appendChild( renderer.domElement );

// animation

function animation( time ) {

	mesh.rotation.x = time / 2000;
	mesh.rotation.y = time / 1000;

	renderer.render( scene, camera );

}

window.addEventListener("resize", onResize);

function onResize() {
 	const [width, height] = [window.innerWidth, window.innerHeight]
  	const aspect = width / height;

	camera.left = (factor * aspect) / -2;
	camera.right = (factor * aspect) / 2;

	camera.updateProjectionMatrix();

	renderer.setSize(width, height);
}