Next.js Discord

Discord Forum

Shaders issue

Unanswered
West African Lion posted this in #help-forum
Open in Discord
West African LionOP
hello, im trying to implement shaders into my nextjs project but ive got an issue with extension .glsl cuz it throws out error when importing (screenshot). ive already tried creating types file:
declare module '*.glsl' {
    const value: string
    export default value
  }


and customizing next.config.ts:
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  webpack(config) {
    config.module.rules.push({
      test: /\.(glsl|vs|fs|vert|frag)$/,
      use: 'raw-loader',
      type: 'asset/source',
    });
    return config;
  },
  experimental: {
    turbo: {
      rules: {
        '**/*.glsl': ['raw-loader']
      },
    },
  },
};

export default nextConfig;

but it still throws out same error. any ideas how can i fix it?

0 Replies