All Projects → wildpeaks → 2018-package-three-webpack-plugin

wildpeaks / 2018-package-three-webpack-plugin

Licence: MIT license
[ARCHIVED] Webpack plugin to use Three.js "examples" classes

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to 2018-package-three-webpack-plugin

Add Asset Webpack Plugin
Dynamically add an asset to the Webpack graph
Stars: ✭ 84 (+86.67%)
Mutual labels:  webpack-plugin, npm-package
Node Env Webpack Plugin
Simplified `NODE_ENV` handling with webpack
Stars: ✭ 51 (+13.33%)
Mutual labels:  webpack-plugin, npm-package
add-module-exports-webpack-plugin
Add `module.exports` for Babel and TypeScript compiled code
Stars: ✭ 36 (-20%)
Mutual labels:  webpack-plugin, npm-package
Handlebars Webpack Plugin
Renders your html-template at build time
Stars: ✭ 135 (+200%)
Mutual labels:  webpack-plugin, npm-package
node-reactive-postgres
Reactive queries for PostgreSQL
Stars: ✭ 28 (-37.78%)
Mutual labels:  npm-package
arcscord
A Discord library written in typescript
Stars: ✭ 18 (-60%)
Mutual labels:  npm-package
monaco-editor-esm-webpack-plugin
No description or website provided.
Stars: ✭ 25 (-44.44%)
Mutual labels:  webpack-plugin
intersection-wasm
Mesh-Mesh and Triangle-Triangle Intersection tests based on the algorithm by Tomas Akenine-Möller
Stars: ✭ 17 (-62.22%)
Mutual labels:  npm-package
stimulus-content-loader
A Stimulus controller to asynchronously load HTML from an url.
Stars: ✭ 39 (-13.33%)
Mutual labels:  npm-package
apate-ar
Framwork for environment aware AR with occlusion, lighting PBR rendering, physics support (cannon.js), based on three.js
Stars: ✭ 77 (+71.11%)
Mutual labels:  threejs
MinifyAllCli
📦 A lightweight, simple and easy npm tool to 𝗺𝗶𝗻𝗶𝗳𝘆 JSON/C, HTML and CSS! Also known as MinifyAll core! ⭐ Usable as 𝑪𝑳𝑰 tool or 𝒊𝒎𝒑𝒐𝒓𝒕𝒂𝒃𝒍𝒆 in TS/JS as a 𝑴𝑶𝑫𝑼𝑳𝑬 🥰
Stars: ✭ 21 (-53.33%)
Mutual labels:  npm-package
size-plugin-bot
A Github bot for size-plugin
Stars: ✭ 76 (+68.89%)
Mutual labels:  webpack-plugin
prettier-eslint-webpack-plugin
Webpack plugin for prettier-eslint which ESLint's settings is set to JavaScript Standard Style
Stars: ✭ 24 (-46.67%)
Mutual labels:  webpack-plugin
spacesvr
A standardized reality for the future of the 3D Web.
Stars: ✭ 135 (+200%)
Mutual labels:  threejs
awesome-threejs
搜集并学习threejs的相关知识总结、Demo、站点、书籍等。
Stars: ✭ 96 (+113.33%)
Mutual labels:  threejs
webpack-stats-diff-plugin
Webpack plugin for reporting changes in bundle sizes across builds
Stars: ✭ 63 (+40%)
Mutual labels:  webpack-plugin
css-chunks-html-webpack-plugin
Injecting css chunks extracted using extract-css-chunks-webpack-plugin to HTML for html-webpack-plugin
Stars: ✭ 22 (-51.11%)
Mutual labels:  webpack-plugin
micro-signals
A tiny typed messaging system inspired by js-signals that uses ES2015 sets
Stars: ✭ 39 (-13.33%)
Mutual labels:  npm-package
virtex
A three.js object viewer written in TypeScript
Stars: ✭ 14 (-68.89%)
Mutual labels:  threejs
car-assembly
基于Vue3.0+WebGL+Nestjs搭建的汽车组装演示系统
Stars: ✭ 44 (-2.22%)
Mutual labels:  threejs

Webpack Plugin: Three

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();

Typescript

Until definitions are integrated directly in @types/three, add a file globals.d.ts at the root of your project to specify the types of the imports, e.g.:

declare module 'three/examples/js/controls/OrbitControls' {
	export const OrbitControls: typeof THREE.OrbitControls;
}

Note that this is not required for compiling to JS, it improves Intellisense in your code editor.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].