Coder Social home page Coder Social logo

plug's Introduction

这是一个很简单的react electron 脚手架。

安装

npm i -r https://registry.taobao.org

or

npm i

启动

  1. npm run dev:dll

先产生 dll js 文件,可以使 webpack 构建速度提升。

  1. npm run dev

webpack 监听 renderer 文件 和 main 文件。

  1. 在另外一个终端执行 npm start

启动 electron。

打包

首先运行 npm run build

然后根据需要运行:

  • npm run pack 打包不产生安装包
  • npm run pack:mac 打包产生dmg安装包
  • npm run pack:win 打包产生exe安装包

windows 下可能运行 npm run pack 失败,那么请替换命令

"pack": "cross-env ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ build --dir",

替换成

"pack": "build --dir",

打包出来的文件在 release 文件夹。

renderer 打包方案

renderer 端打包方案尝试过很多种,master 分支上是个人比较满意的方案。

使用 dll 进行 dev 环境的构建,这样可以快速提高开发速度。 因为 electron 的环境的关系,对 prod 环境其实要求不苛刻,不需要长缓存,只需要体积尽可能小。所以没有很多多余的操作,css 需要提出去。

plug's People

Watchers

 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.