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
{{ message }}
This repository was archived by the owner on Jan 17, 2025. It is now read-only.
Build the app with `npm run build`, then run `npx electron desktop/index.js` to start the app! 🚀
@@ -56,18 +56,18 @@ To circumvent this, create a `electron.server.ts` file, which re-exports from el
56
56
57
57
```ts
58
58
// app/electron.server.ts
59
-
importelectronfrom"electron"
60
-
exportdefaultelectron
59
+
importelectronfrom"electron";
60
+
exportdefaultelectron;
61
61
```
62
62
63
63
```ts
64
64
// app/routes/_index.tsx
65
-
importelectronfrom"~/electron.server"
65
+
importelectronfrom"~/electron.server";
66
66
67
67
exportfunction loader() {
68
68
return {
69
69
userDataPath: electron.app.getPath("userData"),
70
-
}
70
+
};
71
71
}
72
72
```
73
73
@@ -82,7 +82,7 @@ function createWindow() {
82
82
webPreferences: {
83
83
nodeIntegration: true,
84
84
},
85
-
})
85
+
});
86
86
}
87
87
```
88
88
@@ -94,31 +94,33 @@ Initializes remix-electron. Returns a promise with a url to load in the browser
94
94
95
95
Options:
96
96
97
-
-`serverBuild`: The path to your server build (e.g. `path.join(__dirname, 'build')`), or the server build itself (e.g. required from `@remix-run/dev/server-build`). Updates on refresh are only supported when passing a path string.
97
+
-`serverBuild`: The path to your server build (e.g. `path.join(process.cwd(), 'build')`), or the server build itself (e.g. required from `@remix-run/dev/server-build`). Updates on refresh are only supported when passing a path string.
98
98
99
99
-`mode`: The mode the app is running in. Can be `"development"` or `"production"`. Defaults to `"production"` when packaged, otherwise uses `process.env.NODE_ENV`.
100
100
101
-
-`publicFolder`: The folder where static assets are served from, including your browser build. Defaults to `"public"`. Non-relative paths are resolved relative to `app.getAppPath()`.
101
+
-`publicFolder`: The folder where static assets are served from, including your browser build. Defaults to `"public"`. Non-absolute paths are resolved relative to `process.cwd()`.
102
+
103
+
-`getLoadContext`: Use this to inject some value into all of your remix loaders, e.g. an API client. The loaders receive it as `context`.
102
104
103
-
-`getLoadContext`: Use this to inject some value into all of your remix loaders, e.g. an API client. The loaders receive it as `context`
105
+
-`esm`: Set this to `true` to use remix-electron in an ESM application.
104
106
105
107
<details>
106
108
<summary>Load context TS example</summary>
107
109
108
110
**app/context.ts**
109
111
110
112
```ts
111
-
importtype*asremixfrom"@remix-run/node"
113
+
importtype*asremixfrom"@remix-run/node";
112
114
113
115
// your context type
114
116
exporttypeLoadContext= {
115
-
secret:string
116
-
}
117
+
secret:string;
118
+
};
117
119
118
120
// a custom data function args type to use for loaders/actions
0 commit comments