Once done with the setup, you can now continue the development just like you do with the web apps. Try running it again:Īwesome, we now have our Electron + Svelte app ready for development □ The workaround is fairly simple, let's open our index.html file and remove all the / at the start of the links, this should fix it. Apparently, the relevant resources could not be loaded due to the incorrect path, this is due to the fact that we are not serving our resources through any kind of host. Nope, our app appears blank with some errors in the Dev Console. Now, we just need to run npm run dev to compile our Svelte source code, and subsequently, the start script will be called automatically (as predefined in our Rollup config). So, what I did was adding a new field main and pointing it to the index.js file we've just created, and also modifying the start script to invoke Electron to load our compiled code in the app's window. Once done, let's create our index.js file at the root with the following content:Įnter fullscreen mode Exit fullscreen mode Now we install the Electron package by running npm install electron -save-dev. Run npm install to install all necessary dependencies in the template's package.json. This will make a copy of the Svelte template to your machine with the name electron-app-svelte, and a basic structure as seen in the repository. From the CLI, run npx degit sveltejs/template electron-app-svelte. If you have seen my previous post with the browser extension, you should be familiar with this step already. The setup step is pretty simple and straightforward, we're going to start from a Svelte template as it already contains a lot of dependencies gathered in one boilerplate, then we integrate Electron into our app to get started. If you have never heard of any of them, simply click on the links to get to know the awesomeness. In this article, I would like to share my first experience building a desktop app with Electron (with the support from Electron Builder) and Svelte. Hello everyone, welcome to another article in the series Let's build something!, a series dedicated to building, well, something that involves several techs (techniques and technologies) mostly in JavaScript.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |