Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

361
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!