github-pagessveltelivereload

How to remove livereload on production?


I managed to deploy my first Svelte app using Github Pages. Only a problem remains is that the livereload script is still loading but the path to the script cannot be found and causes the slow finishing load as you can see in the live site.

Is there any way to fix this?

Thank you for your help in advance. (The source code if it helps)


Solution

  • The code you've published on GH pages is a dev build. In the official template, that your project seems based on, that's what you get with npm run dev.

    What you need is a production build, that you get with npm run build. The compiled code won't include some utils that are otherwise added for dev tools and HMR, it will be minified with terser, and it won't include livereload. You can see in rollup.config.js there's a production flag, based on whether Rollup run in watch mode or not, that changes some options and plugins.