parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.5k stars 2.27k forks source link

Parcel not bundling right with gltf / glb files / throwing errors #6202

Closed lowellwashere2020 closed 3 years ago

lowellwashere2020 commented 3 years ago

🐛 bug report

Link to the description: https://stackoverflow.com/questions/67301083/parcel-not-bundling-right

Basically, when ever I try to npm run build using parecel I get a

🎛 Configuration (.babelrc, package.json, cli command)

{
  {
  "name": "threejs",
  "version": "1.0.0",
  "description": "testing",
  "main": "index.html",
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
  },
  "author": "",
  "devDependencies": {
    "parcel": "^2.0.0-beta.2",
    "parcel-plugin-static-files-copy": "^2.6.0"
  },
  "dependencies": {
    "cannon": "^0.6.2",
    "jsm": "^0.0.1",
    "socket.io": "^4.0.1",
    "static": "^2.0.0",
    "stats.js": "^0.17.0",
    "three": "^0.127.0"
  }
}

🤔 Expected Behavior

Load a threejs environment with a loaded glb.

😯 Current Behavior

Error GLTFLoader.js:153 SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at GLTFLoader.parse (GLTFLoader.js:283) at Object.onLoad (GLTFLoader.js:173) at XMLHttpRequest. (three.module.js:34701) _onError @ GLTFLoader.js:153

🔦 Context

I'm trying to learn more about threejs and controls in general. Cannot do that.

💻 Code Sample

https://github.com/simondevyoutube/ThreeJS_Tutorial_CharacterController/blob/main/main.js

🌍 Your Environment

Software Version(s)
Parcel 2.0
Node v14.16.0
npm/Yarn
Operating System macos big sur v 11.2.3
mischnic commented 3 years ago

Can test if it works correctly in parcel@nightly?

lowellwashere2020 commented 3 years ago

I haven't used parcel@nightly before. How would I use it?

tried doing npm parcel@nightly but nothing happened as an end result.

mischnic commented 3 years ago

npm i -D parcel@nightly instead of parcel@next

lowellwashere2020 commented 3 years ago

Same issue. :/

mischnic commented 3 years ago

parcel-plugin-static-files-copy is a plugin for Parcel 1. The counterpart for Parcel 2 seems to be https://github.com/elwin013/parcel-reporter-static-files-copy