{"id":19450960,"url":"https://github.com/rixo/sapper-template-hot","last_synced_at":"2025-04-25T04:30:21.392Z","repository":{"id":147724006,"uuid":"216446914","full_name":"rixo/sapper-template-hot","owner":"rixo","description":"WIP Copy of official Sapper template with added HMR support","archived":false,"fork":false,"pushed_at":"2020-06-10T19:52:36.000Z","size":556,"stargazers_count":16,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T15:44:23.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rixo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-21T00:31:50.000Z","updated_at":"2021-02-12T00:23:58.000Z","dependencies_parsed_at":"2023-04-03T14:49:15.978Z","dependency_job_id":null,"html_url":"https://github.com/rixo/sapper-template-hot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rixo%2Fsapper-template-hot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rixo%2Fsapper-template-hot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rixo%2Fsapper-template-hot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rixo%2Fsapper-template-hot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rixo","download_url":"https://codeload.github.com/rixo/sapper-template-hot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250754495,"owners_count":21481822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T16:39:42.630Z","updated_at":"2025-04-25T04:30:21.386Z","avatar_url":"https://github.com/rixo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sapper-template-hot\n\nA clone of the default [Sapper](https://github.com/sveltejs/sapper) template, with added support for HMR. Only available for Webpack currently. (Rollup support for Sapper is pretty hard, and not very high on my priority list.)\n\n\n## Status\n\nSvelte HMR is still quite experimental. Not ready for production. (But you won't ship your HMR, right?)\n\n\n## From scratch\n\n\n### Using `degit`\n\n[`degit`](https://github.com/Rich-Harris/degit) is a scaffolding tool that lets you create a directory from a branch in a repository. Use either the `rollup` or `webpack` branch in `sapper-template`:\n\n```bash\n# for webpack\nnpx degit \"rixo/sapper-template-hot#webpack\" my-app\n```\n\n\n### Running the project\n\nHowever you get the code, you can install dependencies and run the project in development mode with:\n\n```bash\ncd my-app\nnpm install # or yarn\nnpm run dev\n```\n\nOpen up [localhost:3000](http://localhost:3000) and start clicking around.\n\nConsult [sapper.svelte.dev](https://sapper.svelte.dev) for help getting started.\n\nThis project intends to stick to the [official template](https://github.com/sveltejs/sapper-template) as much as possible, so refer to its docs for all details about the template itself.\n\n\n## Add HMR to your existing Sapper project\n\n~~~bash\n# replace svelte-loader with fork with HMR support\nnpm install -D rixo/svelte-loader\n~~~\n\nAdapt your `webpack.config.js` (considering you started from the official template):\n\n~~~js\nconst hot = dev \u0026\u0026 process.env.HOT != 0\n\nmodule.exports = {\n  client: {\n    ...\n    module: {\n      rules: [\n        {\n          test: /\\.(svelte|html)$/,\n          use: {\n            // change svelte-loader to svelte-loader-hot\n            loader: 'svelte-loader-hot',\n            options: {\n              dev, // NOTE dev mode is required for HMR\n              hydratable: true,\n              hotReload: hot,\n              hotOptions: {\n                // optimistic will try to recover from runtime errors during\n                // component init (instead of doing a full reload)\n                optimistic: true,\n              },\n            },\n          },\n        },\n      ],\n    },\n    ...\n    plugins: [\n      // pending https://github.com/sveltejs/svelte/issues/3632\n      hot \u0026\u0026 new webpack.HotModuleReplacementPlugin(),\n      ...\n    ].filter(Boolean),\n  },\n  ...\n}\n~~~\n\n\n## Bugs and feedback\n\nHMR is not officially supported by Svelte (yet?), so please report issues \u0026 feedback about HMR in [this project's issue tracker](https://github.com/rixo/sapper-template-hot/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frixo%2Fsapper-template-hot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frixo%2Fsapper-template-hot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frixo%2Fsapper-template-hot/lists"}