Socket
Socket
Sign inDemoInstall

@vxna/gltf-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vxna/gltf-loader

An opinionated webpack loader for glTF files


Version published
Maintainers
1
Created
Source

@vxna/gltf-loader

Build Status npm

An opinionated webpack loader for glTF files and it's resources.

Warning

  1. Usage with file-loader@>=5.0.0 requires esModule: false option.

  2. This loader emit warning on glTF files with Data URI resources because they are less efficient. If you want self-contained files, consider GLB file format instead and use it with file-loader only.

Options

NameTypeDefaultDescription
inline{Boolean}falseInline glTF into bundle
pretty{Boolean}falseMake glTF human readable

Live code example

Visit this CodeSandbox for the full-featured example that you can download or play online.

Usage with file-loader@>=5.0.0

Inline glTF into bundle (geometry/textures are external):

// webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.gltf$/,
        loader: '@vxna/gltf-loader',
        options: { inline: true }
      },
      {
        test: /\.(bin|jpe?g|png)$/,
        loader: 'file-loader',
        options: { esModule: false }
      }
    ]
  }
}

Output glTF file (geometry/textures are external):

// webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.gltf$/,
        use: [
          {
            loader: 'file-loader',
            options: { esModule: false }
          },
          '@vxna/gltf-loader'
        ]
      },
      {
        test: /\.(bin|jpe?g|png)$/,
        loader: 'file-loader',
        options: { esModule: false }
      }
    ]
  }
}

Credits

Based on webmanifest-loader

License

MIT

Keywords

FAQs

Package last updated on 24 Dec 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