Issue with sapper
See original GitHub issueHello!
So I was trying Sapper with Polka, and it was working great.
Until I found a weird behaviour, that I’m not sure if it’s pokla or sapper. I changed pokla for express and everything works great again. Lets explain the issue:
I needed to serve static files form more than one directory, and sapper by default uses sirv and looks like it’s not recursive, ie, wont serve subdirectories (didnt found any option about it either).
So I added a second “instance” .use('images', serve('assets/images'))
and it didnt work. I was like WHAT? so i “unplugged” sapper from the pipeline and it served the static files like so /images/mysexypic.png.
I thought it was a sapper issue, and maybe it is, but it worked perfectly by using express with it. So by first attempt I think it’s something related to polka.
My express config that works:
var app = express();
app
.use('/images', serve('assets/images'))
.use(
compression({ threshold: 0 }),
sirv('assets'),
sapper({ routes, App })
)
.listen(process.env.PORT)
.on('error', (error) => console.log(error));
Pokla version:
polka()
.use('/images', serve('assets/images'))
.use(
compression({ threshold: 0 })
sirv('assets')
sapper({ routes, App }) //commenting out sapper makes it work.
)
.listen(process.env.PORT)
.catch(err => {
console.log('error', err);
})
Summoning @Rich-Harris just in case 👻
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
Awesome! Thanks for following up 😄
Looks like it’s working!! Polka+sirv = so much win.