Custom StandardMaterial

The shader of here doesn’t work because of some of my cubes are scaled.

The problem of MeshBasicMaterial + .onBeforeCompile is that I use both MeshBasicMaterial and MeshStandardMaterial in other places that I don’t want to show the edges.