npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

three-es6-plugin

v1.0.8

Published

three-es6-plugin ================

Downloads

3

Readme

three-es6-plugin

A webpack plugin for es6-exporting scripts under three/examples/js/.

Good parts: this plugin

  • provides ES6 module interface by transparently re-using original mrdoob/three.js,
  • allows complete configuration of scripts to export,
  • is orthogonal to mrdoob/three.js (hence, always "up-to-date").

We have created this plugin as a webpack-based solution workaround to: Transform examples/js to support modules.

How it works? The plugin dynamically transforms and exports mrdoob/three.js scripts as ES6 module. This generic approach was inspired by marcofugaro/three-addons, which does the same sort of stuff (but in a hardcoded way).

Install

$ npm install three three-es6-plugin

Upon invocation, the plugin references mrdoob/three.js source code. So make sure to install the original package three as well.

Usage

With this plugin, we can flexibly specify which classes (in mrdoob/three.js) to ES6-export. Here, we show a sample usage exporting OrbitControls, OBJLoader, MTLLoader, and DDSLoader.

1) Include the plugin in webpack.config.js as follows. So far, the last workaround line is necessary ;( (cf. webpack/watchpack/issues/25).

const webpack = require('webpack');
const ThreeEs6Plugin = require('three-es6-plugin/dist');

plugins.push(new ThreeEs6Plugin([
    'three/examples/js/controls/OrbitControls.js',  // <-- customize as you like
    'three/examples/js/loaders/OBJLoader.js',       // <--
    'three/examples/js/loaders/MTLLoader.js',       // <--
    'three/examples/js/loaders/DDSLoader.js',       // <--
]));

// workaround for infinite watch-compile loop...
plugins.push(new webpack.WatchIgnorePlugin([ /three-es6-plugin\/es6\/.*\.js$/, ]));

2) In ES6 code, we can now access the exported classes via three-es6-plugin/es6/.

import * as THREE from 'three';
import OrbitControls from 'three-es6-plugin/es6/OrbitControls';
import OBJLoader from 'three-es6-plugin/es6/OBJLoader';
import MTLLoader from 'three-es6-plugin/es6/MTLLoader';
import DDSLoader from 'three-es6-plugin/es6/DDSLoader';

const controls = new OrbitControls(...);
const objl = new OBJLoader();
const mtll = new MTLLoader();
const ddsl = new DDSLoader();

// ...

Demo

A standalone demo is here: three-es6-plugin-demo