You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: How to create an Electron app with Vue 3 and Electron Forge
3
+
---
4
+
5
+
# Vue 3
6
+
7
+
Adding Vue 3 support to a basic Electron Forge template doesn't require a complicated boilerplate to get started.
8
+
9
+
### Create the app
10
+
11
+
Create a standard Electron per the [Getting Started](../../#the-basics) guide.
12
+
13
+
### Add the Vue 3 dependency
14
+
15
+
Add the Vue 3 package to your `dependencies`:
16
+
17
+
{% tabs %}
18
+
{% tab title="NPM" %}
19
+
20
+
```bash
21
+
npm install --save vue
22
+
```
23
+
24
+
{% endtab %}
25
+
26
+
{% tab title="Yarn" %}
27
+
28
+
```bash
29
+
yarn add vue
30
+
```
31
+
32
+
{% endtab %}
33
+
{% endtabs %}
34
+
35
+
### Integrate Vue 3 code
36
+
37
+
You should now be able to start writing and using Vue 3 components in your Electron app. The following is a very minimal example of how to start to add Vue 3 code:
38
+
39
+
{% tabs %}
40
+
{% tab title="src/index.html" %}
41
+
Add the following before the closing `</body>` tag:
### Alternative: Using Single File Components <ahref="#using-single-file-components"id="using-single-file-components"></a>
70
+
71
+
For advanced use cases such as single file components, it's recommended to use the [Webpack plugin](../../config/plugins/webpack.md) so that the components get built correctly. You'll also need to add the appropriate Vue loader/compiler packages to the app's `devDependencies`.
72
+
73
+
Create the app with the [Webpack template](../../templates/webpack-template.md) or the [TypeScript + Webpack template](../../templates/typescript-+-webpack-template.md). Add the following packages to your `devDependencies` so that the single file components get compiled and loaded correctly:
74
+
75
+
{% tabs %}
76
+
{% tab title="NPM" %}
77
+
78
+
```
79
+
npm install --save-dev vue-loader
80
+
```
81
+
82
+
{% endtab %}
83
+
84
+
{% tab title="Yarn" %}
85
+
86
+
```bash
87
+
yarn add --dev vue-loader
88
+
```
89
+
90
+
{% endtab %}
91
+
{% endtabs %}
92
+
93
+
Setting up the [`vue-loader` Webpack module](https://vue-loader.vuejs.org/guide/#webpack-configuration) is left as an exercise for the reader _(hint: `vue-loader` Webpack config should ideally go in the renderer configuration only)_.
94
+
95
+
Add the Vue 3 package to your `dependencies`:
96
+
97
+
{% tabs %}
98
+
{% tab title="NPM" %}
99
+
100
+
```bash
101
+
npm install --save vue
102
+
```
103
+
104
+
{% endtab %}
105
+
106
+
{% tab title="Yarn" %}
107
+
108
+
```bash
109
+
yarn add vue
110
+
```
111
+
112
+
{% endtab %}
113
+
{% endtabs %}
114
+
115
+
You should now be able to add single file components to your app, the same as you would for a "regular" web app.
0 commit comments