elysiajs / elysia-static

Plugin for Elysia for serving static folder
MIT License
12 stars 15 forks source link

Too many symbolic links encountered #20

Open romanzy313 opened 10 months ago

romanzy313 commented 10 months ago

I get the following error while trying to serve node_modules folder:

ELOOP: Too many symbolic links encountered
 syscall: "stat"
   errno: -40

The solution is to not call listFiles if alwaysStatic is set to false. I also think forcing static behavior in production should be removed, as it can be done easily by the library consumer. It is a one-liner like this:

.use(staticPlugin({
  alwaysStatic: process.env.ENV === 'production'
}))

You can find modified version addressing this issue here