umbrella22

更新依赖

......@@ -3,8 +3,12 @@
const chalk = require('chalk')
const electron = require('electron')
const path = require('path')
const { say } = require('cfonts')
const { spawn } = require('child_process')
const {
say
} = require('cfonts')
const {
spawn
} = require('child_process')
const config = require('../config')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
......@@ -38,6 +42,7 @@ function logStats(proc, data) {
log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n'
console.log(log)
}
function removeJunk(chunk) {
if (config.dev.removeElectronJunk) {
// Example: 2018-08-10 22:48:42.866 Electron[90311:4883863] *** WARNING: Textured window <AtomNSWindow: 0x7fb75f68a770>
......@@ -76,7 +81,9 @@ function startRenderer() {
compiler.hooks.compilation.tap('compilation', compilation => {
compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => {
hotMiddleware.publish({ action: 'reload' })
hotMiddleware.publish({
action: 'reload'
})
cb()
})
})
......@@ -86,8 +93,7 @@ function startRenderer() {
})
const server = new WebpackDevServer(
compiler,
{
compiler, {
contentBase: path.join(__dirname, '../'),
quiet: true,
before(app, ctx) {
......@@ -115,7 +121,9 @@ function startMain() {
compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => {
logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, chalk.white.bold(`${config.dev.chineseLog ? '正在处理资源文件...' : 'compiling...'}`))
hotMiddleware.publish({ action: 'compiling' })
hotMiddleware.publish({
action: 'compiling'
})
done()
})
......@@ -210,6 +218,7 @@ function greeting() {
async function init() {
greeting()
try {
await startRenderer()
await startMain()
......@@ -217,6 +226,7 @@ async function init() {
} catch (error) {
console.error(error)
}
}
init()
\ No newline at end of file
......
......@@ -42,6 +42,7 @@ npm config edit
这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
# 更新日志
- 2020年02月06日更新:激进分支更新至8.0.0.
- 2020年01月09日更新:例行更新依赖,在dev中加入了端口监听检测,如果9080端口被占用就会自动向后开启一个端口号并使用,同时在config/index.js的dev中加入了端口设置,可以快捷设置端口号而不用去更改webpack的配置了。
- 2019年12月18日更新:我在build文件夹内添加了windows的打包依赖,在打包爆错的话,可以尝试使用/build/lib内的压缩包,记得看使用说明哦~
- 2019年11月22日更新:得益于群里老哥的提醒,通过修改系统环境变量得到了通过yarn下载electron失败的问题,具体操作如下:用户环境变量中新增两个个变量,一个是变量名为`ELECTRON_MIRROR`,变量值为`https://npm.taobao.org/mirrors/electron/`,另一个是变量名为`registry`,变量值为`https://registry.npm.taobao.org/`,然后系统变量中同样也加上这两个值,完成之后,删除node_module文件夹。然后执行yarn install,如果还是提示未安装,那就去electron文件夹内执行一次yarn install,就好了。这样的话,不仅仅只是yarn更快了,electron的rebuild也会加速很多。所以推荐使用yarn。
......
......@@ -110,14 +110,14 @@
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.6",
"babel-minify-webpack-plugin": "^0.3.1",
"cfonts": "^2.5.0",
"cfonts": "^2.5.2",
"chalk": "^3.0.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^6.0.3",
"cross-env": "^7.0.0",
"css-loader": "^3.4.2",
"del": "^5.1.0",
"electron": "^7.1.11",
"electron": "^8.0.0",
"electron-builder": "^22.3.2",
"electron-devtools-installer": "^2.2.4",
"eslint": "^6.8.0",
......@@ -125,7 +125,7 @@
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^3.0.3",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
......@@ -140,7 +140,7 @@
"sass-loader": "^8.0.2",
"split2": "^3.1.1",
"style-loader": "^1.1.3",
"svg-sprite-loader": "^4.2.0",
"svg-sprite-loader": "^4.2.1",
"terser-webpack-plugin": "^2.3.4",
"through2-filter": "^3.0.0",
"url-loader": "^3.0.0",
......@@ -150,7 +150,7 @@
"vue-template-compiler": "^2.6.11",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1",
"webpack-dev-server": "^3.10.3",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.2"
}
......