Giter VIP home page Giter VIP logo

next-electron's Introduction

next.js + electron.js

this app is built by following this link. it is also summarized in one boilerplate

1 setup

git clone https://github.com/electron/electron-quick-start
yarn
yarn add --dev next@beta react react-dom
yarn add electron-next electron-is-dev
  • electron-next: ensures that Electron can handle next.js' output in the renderer
  • electon-is-dev: changes the main process' behavior depending on the environment the application is running in

Now let's check.

npm start

hello

2 renderer

Use now-desktop as an example.

mkdir renderer && cd renderer
mkdir pages && cd pages

then create start.js as the entry point for next.js and create next.config.js inside renderer to let next.js know where to find start.js.

change main.js to get next.js called.

  • import electron-next
const prepareNext = require('electron-next')
  • replace the existing event listener
app.on('ready', createWindow)

with

app.on('ready', async () => {
  await prepareNext('./renderer')
  createWindow()
})

Then modify loadURL in main.js. Run it.

hello

3 production

yarn add --dev electron-builder

modify pacakge.json

npm run dist

You will get the image built in dist directory.

next-electron's People

Contributors

rdwrcode avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.