Welcome aboard!
Using ShaderMaterial
won’t work because you would need to bind all uniforms/samplers required by the shader as well as handling light binding yourself. See #include directives in shader code output from Node Material Editor - #2 by Evgeni_Popov for more context. This thread is about using the code from a node material, but the problem is the same.
What you can do instead is override the material.customShaderNameResolve
function to modify the shader sent to the gpu. See for eg: