Using gltf-pipeline inside of webworker

Hello community,

I try to include the gltf pipeline into a react app. To improve performance I want to use a web worker but this is optional. Since gltf-pipeline is a node_module I have to convert it to a standalone js. Unfortunately it is not working with browserify as well as webpack.

My webpack.config.js looks like this:

module.exports = {
  entry: './app.js',
  output: {
    path: __dirname + '/public',
    filename: 'worker.js',
  target: "webworker",
  node: {
    fs: 'empty'

My app.js looks like this:

const gltfPipeline = require('gltf-pipeline')
onmessage = e => {   
    const glb = => {
        gltfPipeline.gltfToGlb(, options).then(results => {

After loading the worker this error appears:

Uncaught TypeError: Cannot read property 'native' of undefined
>> "function" == typeof r.realpath.native && (t.realpath.native = n(r.realpath.native))

If I remove the fs part in my config:

node: {
    fs: 'empty'

I am not even able to generate the file:

Module not found: Error: Can't resolve 'fs' in '...node_modules/draco3d'

I would really appreciate your help. Since I want to avoid passing the files to a nodejs server just to convert it and pass it back, a solution within the browser would be much more convenient.



I’m not sure how much work it would be to get gltf-pipeline running directly in the browser, but have you looked at Don McCurdy’s glTF Transform ( ? It provides similar tooling that’s made to run in the browser.

What kind of project are you working on?

Thank, Omar.

That‘s looks good. Converting from ArrayBuffer is exactly what I need. Are you aware if it is possible to convert gltf including webp textures to glb? That is no problem with gltf-pipeline. But the extension isn’t listed in the docs of gltf-transform.

Do you have other recommendations for obj, fbx and other file types converting to glb?