I am trying to load GLSL Shaders in my NextJS Application. I have configured my next.config.js like this:
module.exports = {
reactStrictMode: true,
images: {
domains: [
'localhost',
'backend.rolideluxe.ch'
]
},
webpack: ( config, {} ) => {
config.module.rules.push({
test: /\.mp4$/,
use: {
loader: 'file-loader'
}
})
config.module.rules.push({
test: /\.(glsl|vs|fs|vert|frag)$/,
use: {
loader: 'raw-loader'
}
})
return config
},
}
This returns the error (the bottom part being the shader start of the shader)
./public/shaders/blob/vertex.glsl
Module parse failed: Unexpected token (2:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
> uniform vec2 uFrequency;
I am relatively new to NextJS and ThreeJS and have little more experience with Webpack. I have tried different loaders (like the glsl-shader-loader and the shader-loader), all with the same result. From what I've gathered, the error should lie in the intersection of Webpack and NextJS. Hence my two questions:
- How do I check if a Webpack loader works.
- Any Ideas how I could get my imports to work?