Unable to apply texture to shader material

how to apply texture map in the shader material which uses shader chunk.
I tried two methods but didn’t work… am i missing something or any suggestions.

material.uniforms.map.value = new THREE.TextureLoader().load(url)
material.map= new THREE.TextureLoader().load(url)

Thank you.

Below is the link for the example

See the Pen Three.js Shader test by Sabhareesh (@Sabhareesh) on CodePen.

thank you.

There are several problems with your code. First, you refer to obsolete shader chunks that are not existing anymore. Second, the usage of shader chunks only works if you ensure that certain defines for shader programs like USE_MAP are set. Normally, three.js does this automatically for you when using the built-in materials. However, when using a shader material, you have to set these defines by yourself (like shown in the beneath codepen). Or you set the material properties redundant like so:

material.uniforms.map.value = texture; // to define the uniform value
material.map = texture; // to trigger the definition of "USE_MAP"

Codepen: https://codepen.io/anon/pen/LqrbEP

It worked.

Thank you.