New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gltf-webpack-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gltf-webpack-loader

A gltf loader module for webpack

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-92.59%
Maintainers
1
Weekly downloads
 
Created
Source

gltf-webpack-loader

This is a gltf webpack loader, tested on three.js. Automatically bundles all referenced files.

This loader will resolve all the files referenced in the .gltf file and change their urls depending on the loaders you have defined for these files. Files defined in the .gltf file must be relative to the .gltf file.

This loader still does not work with the public path. We dont have a idea how to solve that.

Usage

Webpack
const config = {
    module:{
      rules:[
        {
          test: /\.(gltf)$/,
          use: [
            {
              loader: "gltf-webpack-loader"
            }
          ]
        }
      ]
    },

    {
      test: /\.(bin)$/,
      use: [
        {
          loader: 'file-loader',
          options: {}
        }
      ]
    }
}
Project
import * as THREE from 'three';
import GLTFLoader from 'three-gltf-loader';

// file is being resolved by loader and a new url is returned.
import gltfPath from 'path/to/your/file.gltf';

const loader = new GLTFLoader();

// all files referenced in the gltf file have now also been resolved by your loaders.
loader.load(gltfPath, gltf => {
        // called when the resource is loaded
        scene.add( gltf.scene );
    },
    ( xhr ) => {
        // called while loading is progressing
        console.log( `${( xhr.loaded / xhr.total * 100 )}% loaded` );
    },
    ( error ) => {
        // called when loading has errors
        console.error( 'An error happened', error );
    },
);

Keywords

FAQs

Package last updated on 06 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc