/three-contrib-loader

Easy for life when you need to use the js contribs in threejs example folders.

Primary LanguageJavaScriptMIT LicenseMIT

npm node deps tests coverage chat

Threejs Contrib Loader

Install

npm install --save-dev three-contrib-loader

⚠️ I don't know if threejs core project will change the release mental to correct this inconvenient issue, so this loader is a hot-fix hack and you should watch the threejs project to follow the future change.

Usage

import * as THREE from "three";
import * as OrbitControlsFactory from "three/examples/js/controls/OrbitControls";

OrbitControlsFactory(THREE);

// Now, THREE entity should have OrbitControls appended.
let controls = new THREE.OrbitControls();

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        // The delimiter of path fragment of stupid windows has the format "//"
        test: /three.*examples.*js/,
        use: [
          {
            loader: "three-contrib-loader"
          }
        ]
      }
    ]
  }
};

Maintainer


Seven Ryze