2.0.0 • Published 7 years ago

@wildpeaks/three-webpack-plugin v2.0.0

Weekly downloads
121
License
MIT
Repository
github
Last release
7 years ago

Webpack Plugin: Three

Build Status Known Vulnerabilities Greenkeeper badge

Webpack plugin to use the additional Three.js "examples" classes that aren't ES Modules, such as THREE.OrbitControls.

Usage

Install packages three and @wildpeaks/three-webpack-plugin:

npm install --save-dev three @wildpeaks/three-webpack-plugin

Add the plugin in your webpack.config.js:

const ThreeWebpackPlugin = require('@wildpeaks/three-webpack-plugin');

module.exports = {
	//...
	plugins: [
		//...
		new ThreeWebpackPlugin()
	]
};

You can now import the classes in your application:

// Import from "three" for core classes
import {Scene, WebGLRenderer} from 'three';

// Import from "three/examples/js" for addditional classes
import {OrbitControls} from 'three/examples/js/controls/OrbitControls';

// Use the imported classes
const scene = new Scene();
const renderer = new WebGLRenderer();
const controls = new OrbitControls();