3

I'm looking into using Snowpack as an alternative to Webpack. By default, if I run the webpack dev server (webpack serve) and no default document exists, browsing to http://localhost:8080 gives me a directory listing. I want to enable the same behaviour in Snowpack, but by default it's returning a 404 Not Found when I browse to /. Is there a config setting or a plugin I can use to enable directory browsing so it works in a similar way to Webpack?

screenshots of http://localhost:8080/ served by webpack serve and by snowpack dev

Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197

2 Answers2

3

By default snowpack doesn't provide that kind of functionality out of the box. But that doesn't mean it's impossible.

You could use express with snowpack server and fallback to serve-index if nothing is found.

Basically you'll have to implement it yourself. But it's not that difficult

Serhiy Mamedov
  • 1,080
  • 5
  • 11
0

Sorry to be the bearer of bad news bud, but I dont think such a thing is able to be done on snowpack. The two bundlers operate a slightly different server, Snowpack needs to use the index.html to route the server to, webpack opens a server the port first then goes off and hosts the files. ( a slightly simplistic take on the two) Sorry I wish I could of been more helpful man,

Dr Gaud
  • 97
  • 3