-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(deps): require Three + Physijs via Webpack + NPM
- use physijs-webpack, a fork I created a few years ago and finally took some time to debug and get working - use via github since someone took the NPM name a few years ago and referenced my repo in it even though it never worked until today... - maybe will update once I get that resolved - now we don't have to vendor in all those scripts anymore and don't need to manually configure Physijs either! - remove the vendored physijs and three scripts - had to debug and modify ammo to get that version working with webpack / bundlers in general - newer versions of Emscripten can target specific envs - c.f. kripken/ammo.js#109 (comment) , webpack/webpack#7352 , and emscripten-core/emscripten#6542 - and then made the worker config more flexible - add worker-loader as a devDep per physijs-webpack instructions - fix publicPath location as this is now actually used - the worker is loaded based on the publicPath - add three-window-resize and three-trackballcontrols as deps as well - since three's examples/js/ folder doesn't quite work with bundlers - c.f. mrdoob/three.js#9562 - maybe if I made some modifications, updated to newer Three revision, and used imports-loader it might work 🤷 TBD - upgrade physijs to latest and Three from r60 to r73 - latest physijs uses r73, so remain consistent - also physijs-webpack has a peerDep for that specific version - three-trackballcontrols@0.0.3 also requires r73 as dep - had to refactor a bit due to upgrade - WebGLRenderer() -> WebGLRenderer({alpha: true}) - the canvas now defaults to black without this, which was extremely disorienting - shadowMapEnabled -> shadowMap.enabled - CubeGeometry -> BoxGeometry - quaternion._euler -> rotation - I probably could've just used this before, couldn't have I...? . . - TODO: improve webpack perf (CPU + Memory) and build speed - this change slows down initial build times quite a bit (~20s), since Three, Physijs, and Ammo are all parsed by Webpack now - will want to update webpack to get a dev-server (wepback-serve) running - webpack itself is faster in later versions as well - and perhaps add HardSource for caching otherwise or split out vendored stuff into a DLL - probably can't update until decaffeinate'd since I believe the loaders used here are no longer maintained :/ - and then would need to figure out the literate programming and its sourcemaps - will want to output a separate vendor bundle per best practice - may also want to output HTML via webpack too while at it - the templates don't do any templating so would be nbd - and would allow for hashing and therefore cache-busting - no need to manually clean cache then - and prod build / uglification is even _slower_ (~80s) - may want to exclude some files from Uglify - i.e. Ammo and use three.min so it can be excluded too
- Loading branch information
Showing
11 changed files
with
32 additions
and
4,193 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters