正在显示
4 个修改的文件
包含
23 行增加
和
12 行删除
| ... | @@ -3,8 +3,12 @@ | ... | @@ -3,8 +3,12 @@ |
| 3 | const chalk = require('chalk') | 3 | const chalk = require('chalk') |
| 4 | const electron = require('electron') | 4 | const electron = require('electron') |
| 5 | const path = require('path') | 5 | const path = require('path') |
| 6 | -const { say } = require('cfonts') | 6 | +const { |
| 7 | -const { spawn } = require('child_process') | 7 | + say |
| 8 | +} = require('cfonts') | ||
| 9 | +const { | ||
| 10 | + spawn | ||
| 11 | +} = require('child_process') | ||
| 8 | const config = require('../config') | 12 | const config = require('../config') |
| 9 | const webpack = require('webpack') | 13 | const webpack = require('webpack') |
| 10 | const WebpackDevServer = require('webpack-dev-server') | 14 | const WebpackDevServer = require('webpack-dev-server') |
| ... | @@ -38,6 +42,7 @@ function logStats(proc, data) { | ... | @@ -38,6 +42,7 @@ function logStats(proc, data) { |
| 38 | log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n' | 42 | log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n' |
| 39 | console.log(log) | 43 | console.log(log) |
| 40 | } | 44 | } |
| 45 | + | ||
| 41 | function removeJunk(chunk) { | 46 | function removeJunk(chunk) { |
| 42 | if (config.dev.removeElectronJunk) { | 47 | if (config.dev.removeElectronJunk) { |
| 43 | // Example: 2018-08-10 22:48:42.866 Electron[90311:4883863] *** WARNING: Textured window <AtomNSWindow: 0x7fb75f68a770> | 48 | // Example: 2018-08-10 22:48:42.866 Electron[90311:4883863] *** WARNING: Textured window <AtomNSWindow: 0x7fb75f68a770> |
| ... | @@ -76,7 +81,9 @@ function startRenderer() { | ... | @@ -76,7 +81,9 @@ function startRenderer() { |
| 76 | 81 | ||
| 77 | compiler.hooks.compilation.tap('compilation', compilation => { | 82 | compiler.hooks.compilation.tap('compilation', compilation => { |
| 78 | compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => { | 83 | compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => { |
| 79 | - hotMiddleware.publish({ action: 'reload' }) | 84 | + hotMiddleware.publish({ |
| 85 | + action: 'reload' | ||
| 86 | + }) | ||
| 80 | cb() | 87 | cb() |
| 81 | }) | 88 | }) |
| 82 | }) | 89 | }) |
| ... | @@ -86,8 +93,7 @@ function startRenderer() { | ... | @@ -86,8 +93,7 @@ function startRenderer() { |
| 86 | }) | 93 | }) |
| 87 | 94 | ||
| 88 | const server = new WebpackDevServer( | 95 | const server = new WebpackDevServer( |
| 89 | - compiler, | 96 | + compiler, { |
| 90 | - { | ||
| 91 | contentBase: path.join(__dirname, '../'), | 97 | contentBase: path.join(__dirname, '../'), |
| 92 | quiet: true, | 98 | quiet: true, |
| 93 | before(app, ctx) { | 99 | before(app, ctx) { |
| ... | @@ -115,7 +121,9 @@ function startMain() { | ... | @@ -115,7 +121,9 @@ function startMain() { |
| 115 | 121 | ||
| 116 | compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => { | 122 | compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => { |
| 117 | logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, chalk.white.bold(`${config.dev.chineseLog ? '正在处理资源文件...' : 'compiling...'}`)) | 123 | logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, chalk.white.bold(`${config.dev.chineseLog ? '正在处理资源文件...' : 'compiling...'}`)) |
| 118 | - hotMiddleware.publish({ action: 'compiling' }) | 124 | + hotMiddleware.publish({ |
| 125 | + action: 'compiling' | ||
| 126 | + }) | ||
| 119 | done() | 127 | done() |
| 120 | }) | 128 | }) |
| 121 | 129 | ||
| ... | @@ -210,6 +218,7 @@ function greeting() { | ... | @@ -210,6 +218,7 @@ function greeting() { |
| 210 | 218 | ||
| 211 | async function init() { | 219 | async function init() { |
| 212 | greeting() | 220 | greeting() |
| 221 | + | ||
| 213 | try { | 222 | try { |
| 214 | await startRenderer() | 223 | await startRenderer() |
| 215 | await startMain() | 224 | await startMain() |
| ... | @@ -217,6 +226,7 @@ async function init() { | ... | @@ -217,6 +226,7 @@ async function init() { |
| 217 | } catch (error) { | 226 | } catch (error) { |
| 218 | console.error(error) | 227 | console.error(error) |
| 219 | } | 228 | } |
| 229 | + | ||
| 220 | } | 230 | } |
| 221 | 231 | ||
| 222 | init() | 232 | init() |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -42,6 +42,7 @@ npm config edit | ... | @@ -42,6 +42,7 @@ npm config edit |
| 42 | 这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin) | 42 | 这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin) |
| 43 | 43 | ||
| 44 | # 更新日志 | 44 | # 更新日志 |
| 45 | +- 2020年02月06日更新:激进分支更新至8.0.0. | ||
| 45 | - 2020年01月09日更新:例行更新依赖,在dev中加入了端口监听检测,如果9080端口被占用就会自动向后开启一个端口号并使用,同时在config/index.js的dev中加入了端口设置,可以快捷设置端口号而不用去更改webpack的配置了。 | 46 | - 2020年01月09日更新:例行更新依赖,在dev中加入了端口监听检测,如果9080端口被占用就会自动向后开启一个端口号并使用,同时在config/index.js的dev中加入了端口设置,可以快捷设置端口号而不用去更改webpack的配置了。 |
| 46 | - 2019年12月18日更新:我在build文件夹内添加了windows的打包依赖,在打包爆错的话,可以尝试使用/build/lib内的压缩包,记得看使用说明哦~ | 47 | - 2019年12月18日更新:我在build文件夹内添加了windows的打包依赖,在打包爆错的话,可以尝试使用/build/lib内的压缩包,记得看使用说明哦~ |
| 47 | - 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。 | 48 | - 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 @@ | ... | @@ -110,14 +110,14 @@ |
| 110 | "babel-eslint": "^9.0.0", | 110 | "babel-eslint": "^9.0.0", |
| 111 | "babel-loader": "^8.0.6", | 111 | "babel-loader": "^8.0.6", |
| 112 | "babel-minify-webpack-plugin": "^0.3.1", | 112 | "babel-minify-webpack-plugin": "^0.3.1", |
| 113 | - "cfonts": "^2.5.0", | 113 | + "cfonts": "^2.5.2", |
| 114 | "chalk": "^3.0.0", | 114 | "chalk": "^3.0.0", |
| 115 | "clean-webpack-plugin": "^3.0.0", | 115 | "clean-webpack-plugin": "^3.0.0", |
| 116 | "copy-webpack-plugin": "^5.1.1", | 116 | "copy-webpack-plugin": "^5.1.1", |
| 117 | - "cross-env": "^6.0.3", | 117 | + "cross-env": "^7.0.0", |
| 118 | "css-loader": "^3.4.2", | 118 | "css-loader": "^3.4.2", |
| 119 | "del": "^5.1.0", | 119 | "del": "^5.1.0", |
| 120 | - "electron": "^7.1.11", | 120 | + "electron": "^8.0.0", |
| 121 | "electron-builder": "^22.3.2", | 121 | "electron-builder": "^22.3.2", |
| 122 | "electron-devtools-installer": "^2.2.4", | 122 | "electron-devtools-installer": "^2.2.4", |
| 123 | "eslint": "^6.8.0", | 123 | "eslint": "^6.8.0", |
| ... | @@ -125,7 +125,7 @@ | ... | @@ -125,7 +125,7 @@ |
| 125 | "eslint-friendly-formatter": "^4.0.1", | 125 | "eslint-friendly-formatter": "^4.0.1", |
| 126 | "eslint-loader": "^3.0.3", | 126 | "eslint-loader": "^3.0.3", |
| 127 | "eslint-plugin-html": "^6.0.0", | 127 | "eslint-plugin-html": "^6.0.0", |
| 128 | - "eslint-plugin-import": "^2.20.0", | 128 | + "eslint-plugin-import": "^2.20.1", |
| 129 | "eslint-plugin-node": "^9.2.0", | 129 | "eslint-plugin-node": "^9.2.0", |
| 130 | "eslint-plugin-promise": "^4.2.1", | 130 | "eslint-plugin-promise": "^4.2.1", |
| 131 | "eslint-plugin-standard": "^4.0.0", | 131 | "eslint-plugin-standard": "^4.0.0", |
| ... | @@ -140,7 +140,7 @@ | ... | @@ -140,7 +140,7 @@ |
| 140 | "sass-loader": "^8.0.2", | 140 | "sass-loader": "^8.0.2", |
| 141 | "split2": "^3.1.1", | 141 | "split2": "^3.1.1", |
| 142 | "style-loader": "^1.1.3", | 142 | "style-loader": "^1.1.3", |
| 143 | - "svg-sprite-loader": "^4.2.0", | 143 | + "svg-sprite-loader": "^4.2.1", |
| 144 | "terser-webpack-plugin": "^2.3.4", | 144 | "terser-webpack-plugin": "^2.3.4", |
| 145 | "through2-filter": "^3.0.0", | 145 | "through2-filter": "^3.0.0", |
| 146 | "url-loader": "^3.0.0", | 146 | "url-loader": "^3.0.0", |
| ... | @@ -150,7 +150,7 @@ | ... | @@ -150,7 +150,7 @@ |
| 150 | "vue-template-compiler": "^2.6.11", | 150 | "vue-template-compiler": "^2.6.11", |
| 151 | "webpack": "^4.41.5", | 151 | "webpack": "^4.41.5", |
| 152 | "webpack-cli": "^3.3.10", | 152 | "webpack-cli": "^3.3.10", |
| 153 | - "webpack-dev-server": "^3.10.1", | 153 | + "webpack-dev-server": "^3.10.3", |
| 154 | "webpack-hot-middleware": "^2.25.0", | 154 | "webpack-hot-middleware": "^2.25.0", |
| 155 | "webpack-merge": "^4.2.2" | 155 | "webpack-merge": "^4.2.2" |
| 156 | } | 156 | } | ... | ... |
-
请 注册 或 登录 后发表评论