question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with sapper

See original GitHub issue

Hello!

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:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lukeedcommented, Jul 27, 2018

Awesome! Thanks for following up 😄

1reaction
andreujuanccommented, Jul 27, 2018

Looks like it’s working!! Polka+sirv = so much win.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · sveltejs/sapper - GitHub
Issues list ; sapper.scripts includes error messages which may involve security issues. #1810 opened on Apr 7 ; Incorrect Static HTML generation. #1805...
Read more >
i have an issue on sapper export with js interaction
i have an issue on sapper. When i export my static website npm run export through browser-sync work correctly, when i put it...
Read more >
Blank page issue with Sapper & Ionic : r/sveltejs - Reddit
Help! Added ionic to my site and sometimes it comes up blank. Anyone else encountering this issue? I tried with the starter sapper...
Read more >
U.S. Army Combat Engineers Sapper Sweatshirt - Amazon.com
U.S. Army Combat Engineers Sapper Pullover Hoodie. Patriot Issue. U.S. Army Combat Engineers Sapper Pullover Hoodie ; U.S. Army 9th Infantry Division Sweatshirt....
Read more >
Authentic New U.S. Army Sapper Tab Pin, U.S. Government ...
Authentic New US Army Special Forces Tab Pin, US Government Issue, Regular Size. $19.99. + $3.00 shipping+ $3.00 shipping ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found