I had to use raw-loader.
import testVertexShader from "!!raw-loader!@/shaders/test/vertex.glsl";
import testFragmentShader from "!!raw-loader!@/shaders/test/fragment.glsl";
Found the solution in this great tutorial about shaders and react three fiber.