routify icon indicating copy to clipboard operation
routify copied to clipboard

Usage with Electron

Open agrear opened this issue 5 years ago • 1 comments

Thought I'd share my experience integrating Routify with Electron since I couldn't find anything regarding the setup process in the Guide/FAQ.

Following Building a Desktop App using Svelte and Electron, I managed to get the development build running fairly easily. However when attempting to package everything into an app I encountered some issues.

After installing electron-builder I came up with the following config:

{
  "appId": "routify-app",
  "directories": {
    "buildResources": "assets",
    "output": "packaged"
  },
  "files": [
    "assets/electron.js",
    "dist/**/*"
  ]
}

This packages all resources into the app and saves the output in 'packaged'.

Next up I had to change the URLs inside assets/__app.html from absolute to relative (this is mentioned in the tutorial). So /build/main.js becomes ./build/main.js for instance, otherwise Electron won't be able to find the resources.

Lastly I had to enable hash based routing and change the URL to the example route in src/pages/example/_components/RoutifyIntro.svelte to href="#/example".

agrear avatar Dec 13 '20 22:12 agrear

Thanks for sharing @agrear. If there are no issues, I'll close this. 🙂

jakobrosenberg avatar Dec 14 '20 17:12 jakobrosenberg