# electron-next

> Build Electron apps using Next.js

Latest version **3.1.5** (published 2018-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install electron-next
pnpm add electron-next
yarn add electron-next
bun add electron-next
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.5 |
| Published | 2018-09-21 |
| First published | 2017-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 549 |
| Author | leo |
| Maintainers | leo |
| Keywords | electron, next, electron.js, next.js |

## Links

- npm: https://www.npmjs.com/package/electron-next
- Repository: https://github.com/leo/electron-next
- Homepage: https://github.com/leo/electron-next#readme
- Issues: https://github.com/leo/electron-next/issues
- npm.io page: https://npm.io/package/electron-next

## Dependencies (2)

- [app-root-path](https://npm.io/package/app-root-path.md) >=2.0.1
- [electron-is-dev](https://npm.io/package/electron-is-dev.md) >=0.3.0

## Recent versions

- 3.1.5 (latest) — 2018-09-21
- 3.1.4 — 2018-02-25
- 3.1.3 — 2017-08-31
- 3.1.2 — 2017-08-26
- 3.1.1 — 2017-08-13
- 3.1.0 — 2017-08-13
- 3.0.8 — 2017-08-04
- 3.0.7 — 2017-07-03
- 3.0.6 — 2017-07-02
- 3.0.5 — 2017-06-15
- 3.0.4 — 2017-06-15
- 3.0.3 — 2017-06-15
- 3.0.2 — 2017-06-13
- 3.0.0 — 2017-06-10
- 2.0.4 — 2017-05-24
- … 6 more at https://npm.io/package/electron-next/versions

## README

# electron-next

[![Build Status](https://travis-ci.org/leo/electron-next.svg?branch=master)](https://travis-ci.org/leo/electron-next)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](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:

- `<path>`: 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).
- `<port>`: Used for running [Next.js](https://github.com/zeit/next.js) in development (number, **optional**, defaults to `8000`).

```js
await prepareRenderer(<path>, <port>)
```

## 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))

---
_Source: https://npm.io/package/electron-next · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
