https://github.com/leo/electron-next
Build Electron apps using Next.js
https://github.com/leo/electron-next
electron main next renderer
Last synced: 5 months ago
JSON representation
Build Electron apps using Next.js
- Host: GitHub
- URL: https://github.com/leo/electron-next
- Owner: leo
- License: mit
- Created: 2017-04-08T13:16:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-05-28T13:46:56.000Z (over 2 years ago)
- Last Synced: 2025-05-10T01:06:48.993Z (5 months ago)
- Topics: electron, main, next, renderer
- Language: JavaScript
- Homepage: https://github.com/leo/site/blob/beef3a7dc1dfd435a9d8377e3b1b59761ccb7fc7/pages/2017/electron-next.js
- Size: 93.8 KB
- Stars: 550
- Watchers: 7
- Forks: 41
- Open Issues: 16
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# electron-next
[](https://travis-ci.org/leo/electron-next)
[](https://github.com/sindresorhus/xo)This package lets you use [Next.js](https://github.com/zeit/next.js) for building the renderer of your [Electron](https://electron.atom.io) apps!
- In **production**, it ensures that the `file://` protocol (which Electron uses to load your static assets in the renderer process) works properly with your Next.js bundle (generated by `next export`)
- While **developing**, it takes care of the whole flow required for building the renderer code## Usage
Firstly, install the package using any node package manager:
```bash
yarn add electron-next
```Then load it:
```js
const prepareRenderer = require('electron-next')
```As the final step, call the package:
- ``: The path to the directory containing the renderer (relative to the app's root directory). If the paths for development and production aren't the same, this can be an object holding a `development` and a `production` key with their respective paths (string|object).
- ``: Used for running [Next.js](https://github.com/zeit/next.js) in development (number, **optional**, defaults to `8000`).```js
await prepareRenderer(, )
```## Caught a Bug?
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
2. Link the package to the global package directory: `npm link`
3. Within the electron app of your choice, link it to the dependencies: `npm link electron-next`. Instead of the default one from [npm](https://www.npmjs.com), it will now use your local clone of the package!## Author
- Leo Lamprecht ([@notquiteleo](https://twitter.com/notquiteleo))