thgh / vercel-sapper

Vercel builder for Sapper with SSR enabled
MIT License
189 stars 25 forks source link

Error: Couldn't find your server instance. Did you write `module.exports = app`? #31

Closed ryanditjia closed 4 years ago

ryanditjia commented 4 years ago

Hi, I’m getting an error that seems like a false negative.

The error is:

This is now-sapper, your Vercel builder. Turns out we couldn't find your server instance. Did you write module.exports = app?

Read the docs or create an issue: https://github.com/thgh/now-sapper

My server.js looks as follows.

const app = polka() // You can also use Express
// …

export default app
ryanditjia commented 4 years ago

Looks like this was it.

This problem happens if the server portion of your rollup.config.js you have preserveEntrySignatures set to false.

thgh commented 4 years ago

For future reference:

// Is NOT preserved when preserveEntrySignatures: false
export default app

// Is preserved when preserveEntrySignatures: 'strict'
export default app

// Is preserved when preserveEntrySignatures: false
module.exports = app

// Is preserved when preserveEntrySignatures: 'strict'
module.exports = app