Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

370
Vistas
Anyone have experience with loading a GLB file with webpack?

I am trying to use a .glb file into a react-fiber-three app.

Error says about a GLB file:

Module parse failed: Unexpected character '' (1:4) You may need an appropriate loader to handle this file type

My file using this file:

export default function Blender() {
    const gltf = useLoader(GLTFLoader, gumballmachinepink);

    return (
        <primitive
            object={gltf.scene}
            position={[0, 0, 0]}
            scale={10}
            rotation={[0, 0, 0]}
        />
    ) }

useGLTF.preload(gumballmachinepink);

My Webpack.config file:

module.exports = {
    mode: 'production',
    entry: path.join(__dirname, 'App.tsx'),
    devtool: "source-map",
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'own-me-gumball-machine.prod.js',
    },
    module: {
        rules: [
            {
                
                test: /\.(ts|js)x?$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets: [
                            "@babel/preset-env",
                            "@babel/preset-react",
                            "@babel/preset-typescript",
                        ],
                    },
                },
            },
            {
                test: /\.(glb|gltf)$/,
                use:
                [
                    {
                        loader: 'file-loader',
                        options:
                        {
                            outputPath: 'assets/models/'
                        }
                    }
                ]
            },
            {
                test: /\.css$/i,
                use: ['style-loader', 'css-loader'],
            },
            {
                test: /\.(png|jpe?g|gif|woff(2)?|svg)$/i,
                type: 'asset/resource'
            },
        ]
    },
    resolve: {
        extensions: [".tsx", ".ts", ".js", ".css"],
    },
    plugins: [
        new HtmlWebpackPlugin({
            inject: true,
            template: path.join(__dirname, 'index.html'),
        }),
        // new CopyPlugin({
        //     patterns: [
        //         { from: "media/favicons/", to: "media/favicons/" },
        //     ],
        // }),
    ] };
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda