Usé Parcel como mi paquete web y three.js, pasé este proyecto a github y lo implementé con Vercel . Funciona perfectamente bien sin errores en mi host local (parcel index.html ->http://localhost:1234).
Sin embargo, NO se ejecuta en vercel . Dice esto en la consola:
Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".Estas son las líneas a las que se refiere (Experiencia: 1):
import * as THREE from "three"; //this line import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader"; import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";Intenté agregar "/" o "./" o "../" pero esto solo rompe mi aplicación y ya no se ejecuta en mi servidor local.
Aquí está mi package.json
{ "name": "audio-visualizer-tutorial", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "gsap": "^3.8.0", "lil-gui": "^0.14.0", "regenerator-runtime": "^0.13.9", "three": "^0.135.0" }, "devDependencies": { "@babel/plugin-transform-runtime": "^7.16.4", "glslify-bundle": "^5.1.1", "glslify-deps": "^1.3.2", "parcel-plugin-static-files-copy": "^2.6.0" } }