Vite with url-loader

1.5k Views Asked by At

I need to handle GLTF and HDR files in my Vue/Three.js application. This doesn't work out of the box with Vite. With Webpack I can set this in the Webpack config

module.exports = {
  module: {
    rules: [
      {
        test: /\.(gltf)$/i,
        use: [
          {
            loader: 'url-loader',
          },
        ],
      },
    ],
  },
};

Is there a way to do the same in Vite?

1

There are 1 best solutions below

1
On

Seems like Vite can handle this out of the box. The problem was the cors settings of the server the files were on.