npm init -y
- Add
"private": true,
param to package.json and rename "name" param npm install webpack webpack-cli --save-dev
for webpacknpm install --save three
for threejsnpm install webpack-dev-server --save-dev
for live reloading- Write js code in src/index.js
- To include threejs modules, use its path relative to its place in the three-js-repo (i.e.,
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
)
- Write html code in dist/index.html
npx webpack serve
to build ornpx webpack serve --no-client-overlay --live-reload
to serve on localhost with no error msg overlay and live reloading- Upload contents of dist/ to web server