Saturday, 16 November 2019

Import glsl file in angular nx project

I'm trying to import a glsl file (without requiring module with require()) in components but seems not working.

My first try was create a glsl.d.ts file with module declaration as follow:

declare module '*.glsl' {
  const value: string
  export default value
}

This solve the warning, but a dedicated loader seems required.

My second try was to use custom-webpack and glslify-loader with the following condifuration:

module.exports = {
  module: {
    rules: [
      {
        test: /\.(glsl|frag|vert|png|svg|jpg|gif|obj)$/,
        use: [
            'file-loader'
        ]
      }
    ]
  }
};

But still not works...

Can someone help me?

Here the stackbliz example



from Import glsl file in angular nx project

No comments:

Post a Comment