sveltejs/sapper

Updates to Sapper for a smoother transition to SvelteKit

btakita opened this issue · 1 comments

Sapper development has ended but SvelteKit & Vite are not yet stable & currently not ready for some projects, particularly re: SSR issues (vitejs/vite#4230).

As anybody who has gone through a migration with a large project can attest to, unforeseen edge cases often occur. There is also hidden downstream technical risk to the SvelteKit migration being successful at this time. This often occurs where it's difficult to justify prioritizing the migration when balancing with client project needs.

In the meantime, some projects on Sapper are waiting for SvelteKit to mature to a point to where the risk of a migration is minimized. I went through the steps of transition to SvelteKit due to needing SPA support which will not occur with Sapper (#383), including converting all dependent libraries to "type": "module" among other changes suggested in https://kit.svelte.dev/migrating.

Now having to go back to supporting Sapper due to running into SSR issues including sveltejs/kit#1947, I realize that Sapper does not support ES modules & has a different api from SvelteKit. It would be great if Sapper could be retrofitted to support some of the SvelteKit configurations & api so a future transition is made easier & the migration process can be de-risked by allowing failed migrations to be transitioned back to Sapper.

The changes should be minor, such as allowing rollup.config.mjs to support ES modules (#1204). Another nice to have would be support for the load (an alternative to preload) function with the same api as SvelteKit. Any other compatible SvelteKit updates can also be backported.

Deprecation of Sapper's unique api & compatible with SvelteKit behavior may also be useful to encourage existing Sapper projects to consider & move over to SvelteKit.

I have a PR cooking to add ESM support & a global fetch via server.mjs. There's a dependency PR for cheap-watch Conduitry/cheap-watch#10. Since using a pnpm vendor multirepo to test this on my project, will need to have the cheap-watch PR merged before posting a PR for sapper.