I recently learned a nice way to manage your .env files in your Svelte projects. If you're using Rollup as your bundling tool, which is likely to be the case, you can use the node module dotenv to automatically inject the content of a .env file into your web page.

Read full post

When reading Svelte 3 documentation of the {#each} keyword, it isn't clear how to correctly handle the case where the variable we want to iterate on is null or undefined.

A common use case is listing the result of an object of type Promise<MyItem[]>. We could imagine for example that this promise represents the result of an HTTP request. We would first initialized the promise to null as a way to communicate that we didn't fetch any result yet.

Read full post