正在显示
8 个修改的文件
包含
56 行增加
和
17 行删除
| ... | @@ -2,12 +2,14 @@ | ... | @@ -2,12 +2,14 @@ |
| 2 | 2 | ||
| 3 | process.env.BABEL_ENV = 'main' | 3 | process.env.BABEL_ENV = 'main' |
| 4 | 4 | ||
| 5 | +const os = require('os') | ||
| 5 | const path = require('path') | 6 | const path = require('path') |
| 6 | const { dependencies } = require('../package.json') | 7 | const { dependencies } = require('../package.json') |
| 7 | const webpack = require('webpack') | 8 | const webpack = require('webpack') |
| 8 | - | ||
| 9 | const MinifyPlugin = require("babel-minify-webpack-plugin"); | 9 | const MinifyPlugin = require("babel-minify-webpack-plugin"); |
| 10 | const { CleanWebpackPlugin } = require('clean-webpack-plugin') | 10 | const { CleanWebpackPlugin } = require('clean-webpack-plugin') |
| 11 | +const HappyPack = require('happypack') | ||
| 12 | +const HappyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length }) | ||
| 11 | 13 | ||
| 12 | function resolve(dir) { | 14 | function resolve(dir) { |
| 13 | return path.join(__dirname, '..', dir) | 15 | return path.join(__dirname, '..', dir) |
| ... | @@ -35,7 +37,7 @@ let mainConfig = { | ... | @@ -35,7 +37,7 @@ let mainConfig = { |
| 35 | // }, | 37 | // }, |
| 36 | { | 38 | { |
| 37 | test: /\.js$/, | 39 | test: /\.js$/, |
| 38 | - use: 'babel-loader', | 40 | + use: 'happypack/loader?id=MainHappyBabel', |
| 39 | exclude: /node_modules/ | 41 | exclude: /node_modules/ |
| 40 | }, | 42 | }, |
| 41 | { | 43 | { |
| ... | @@ -57,6 +59,16 @@ let mainConfig = { | ... | @@ -57,6 +59,16 @@ let mainConfig = { |
| 57 | new webpack.NoEmitOnErrorsPlugin(), | 59 | new webpack.NoEmitOnErrorsPlugin(), |
| 58 | new CleanWebpackPlugin({ | 60 | new CleanWebpackPlugin({ |
| 59 | cleanOnceBeforeBuildPatterns: resolve('dist/electron') | 61 | cleanOnceBeforeBuildPatterns: resolve('dist/electron') |
| 62 | + }), | ||
| 63 | + new HappyPack({ | ||
| 64 | + id: "MainHappyBabel", | ||
| 65 | + loaders: [{ | ||
| 66 | + loader: 'babel-loader', | ||
| 67 | + options: { | ||
| 68 | + cacheDirectory: true | ||
| 69 | + } | ||
| 70 | + }], | ||
| 71 | + threadPool: HappyThreadPool | ||
| 60 | }) | 72 | }) |
| 61 | ], | 73 | ], |
| 62 | resolve: { | 74 | resolve: { | ... | ... |
| ... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | ||
| 3 | process.env.BABEL_ENV = 'renderer' | 3 | process.env.BABEL_ENV = 'renderer' |
| 4 | 4 | ||
| 5 | +const os = require('os') | ||
| 5 | const path = require('path') | 6 | const path = require('path') |
| 6 | const { dependencies } = require('../package.json') | 7 | const { dependencies } = require('../package.json') |
| 7 | const webpack = require('webpack') | 8 | const webpack = require('webpack') |
| ... | @@ -12,7 +13,10 @@ const CopyWebpackPlugin = require('copy-webpack-plugin') | ... | @@ -12,7 +13,10 @@ const CopyWebpackPlugin = require('copy-webpack-plugin') |
| 12 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') | 13 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') |
| 13 | const HtmlWebpackPlugin = require('html-webpack-plugin') | 14 | const HtmlWebpackPlugin = require('html-webpack-plugin') |
| 14 | const TerserPlugin = require('terser-webpack-plugin'); | 15 | const TerserPlugin = require('terser-webpack-plugin'); |
| 16 | +const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); | ||
| 15 | const { VueLoaderPlugin } = require('vue-loader') | 17 | const { VueLoaderPlugin } = require('vue-loader') |
| 18 | +const HappyPack = require('happypack') | ||
| 19 | +const HappyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length }) | ||
| 16 | 20 | ||
| 17 | function resolve(dir) { | 21 | function resolve(dir) { |
| 18 | return path.join(__dirname, '..', dir) | 22 | return path.join(__dirname, '..', dir) |
| ... | @@ -24,7 +28,7 @@ function resolve(dir) { | ... | @@ -24,7 +28,7 @@ function resolve(dir) { |
| 24 | * that provide pure *.vue files that need compiling | 28 | * that provide pure *.vue files that need compiling |
| 25 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals | 29 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals |
| 26 | */ | 30 | */ |
| 27 | -let whiteListedModules = ['vue',"element-ui"] | 31 | +let whiteListedModules = ['vue', "element-ui"] |
| 28 | 32 | ||
| 29 | let rendererConfig = { | 33 | let rendererConfig = { |
| 30 | devtool: '#cheap-module-eval-source-map', | 34 | devtool: '#cheap-module-eval-source-map', |
| ... | @@ -69,7 +73,7 @@ let rendererConfig = { | ... | @@ -69,7 +73,7 @@ let rendererConfig = { |
| 69 | }, | 73 | }, |
| 70 | { | 74 | { |
| 71 | test: /\.js$/, | 75 | test: /\.js$/, |
| 72 | - use: 'babel-loader', | 76 | + use: 'happypack/loader?id=HappyRendererBabel', |
| 73 | exclude: /node_modules/ | 77 | exclude: /node_modules/ |
| 74 | }, | 78 | }, |
| 75 | { | 79 | { |
| ... | @@ -164,7 +168,18 @@ let rendererConfig = { | ... | @@ -164,7 +168,18 @@ let rendererConfig = { |
| 164 | nodeModules: false | 168 | nodeModules: false |
| 165 | }), | 169 | }), |
| 166 | new webpack.HotModuleReplacementPlugin(), | 170 | new webpack.HotModuleReplacementPlugin(), |
| 167 | - new webpack.NoEmitOnErrorsPlugin() | 171 | + new webpack.NoEmitOnErrorsPlugin(), |
| 172 | + new HardSourceWebpackPlugin(), | ||
| 173 | + new HappyPack({ | ||
| 174 | + id: 'HappyRendererBabel', | ||
| 175 | + loaders: [{ | ||
| 176 | + loader: 'babel-loader', | ||
| 177 | + options: { | ||
| 178 | + cacheDirectory: true | ||
| 179 | + } | ||
| 180 | + }], | ||
| 181 | + threadPool: HappyThreadPool | ||
| 182 | + }), | ||
| 168 | ], | 183 | ], |
| 169 | output: { | 184 | output: { |
| 170 | filename: '[name].js', | 185 | filename: '[name].js', |
| ... | @@ -187,7 +202,8 @@ let rendererConfig = { | ... | @@ -187,7 +202,8 @@ let rendererConfig = { |
| 187 | if (process.env.NODE_ENV !== 'production') { | 202 | if (process.env.NODE_ENV !== 'production') { |
| 188 | rendererConfig.plugins.push( | 203 | rendererConfig.plugins.push( |
| 189 | new webpack.DefinePlugin({ | 204 | new webpack.DefinePlugin({ |
| 190 | - '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"` | 205 | + '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`, |
| 206 | + '__lib': `"${path.join(__dirname, `../${config.DllFolder}`).replace(/\\/g, '\\\\')}"` | ||
| 191 | }) | 207 | }) |
| 192 | ) | 208 | ) |
| 193 | } | 209 | } | ... | ... |
此文件的差异被折叠,
点击展开。
| ... | @@ -20,6 +20,7 @@ | ... | @@ -20,6 +20,7 @@ |
| 20 | "update:serve": "node server/index.js" | 20 | "update:serve": "node server/index.js" |
| 21 | }, | 21 | }, |
| 22 | "build": { | 22 | "build": { |
| 23 | + "extraFiles": [], | ||
| 23 | "publish": [ | 24 | "publish": [ |
| 24 | { | 25 | { |
| 25 | "provider": "generic", | 26 | "provider": "generic", |
| ... | @@ -71,9 +72,8 @@ | ... | @@ -71,9 +72,8 @@ |
| 71 | "dependencies": { | 72 | "dependencies": { |
| 72 | "axios": "^0.19.2", | 73 | "axios": "^0.19.2", |
| 73 | "date-fns": "^2.10.0", | 74 | "date-fns": "^2.10.0", |
| 74 | - "electron-updater": "^4.2.2", | 75 | + "electron-updater": "^4.2.4", |
| 75 | "element-ui": "^2.13.0", | 76 | "element-ui": "^2.13.0", |
| 76 | - "ffi-napi": "^2.4.6", | ||
| 77 | "fs-extra": "^8.1.0", | 77 | "fs-extra": "^8.1.0", |
| 78 | "js-cookie": "^2.2.1", | 78 | "js-cookie": "^2.2.1", |
| 79 | "nedb": "^1.8.0", | 79 | "nedb": "^1.8.0", |
| ... | @@ -85,7 +85,7 @@ | ... | @@ -85,7 +85,7 @@ |
| 85 | "vuex-electron": "^1.0.3" | 85 | "vuex-electron": "^1.0.3" |
| 86 | }, | 86 | }, |
| 87 | "devDependencies": { | 87 | "devDependencies": { |
| 88 | - "@babel/core": "^7.8.6", | 88 | + "@babel/core": "^7.8.7", |
| 89 | "@babel/plugin-proposal-class-properties": "^7.8.3", | 89 | "@babel/plugin-proposal-class-properties": "^7.8.3", |
| 90 | "@babel/plugin-proposal-decorators": "^7.8.3", | 90 | "@babel/plugin-proposal-decorators": "^7.8.3", |
| 91 | "@babel/plugin-proposal-do-expressions": "^7.8.3", | 91 | "@babel/plugin-proposal-do-expressions": "^7.8.3", |
| ... | @@ -103,10 +103,10 @@ | ... | @@ -103,10 +103,10 @@ |
| 103 | "@babel/plugin-syntax-dynamic-import": "^7.8.3", | 103 | "@babel/plugin-syntax-dynamic-import": "^7.8.3", |
| 104 | "@babel/plugin-syntax-import-meta": "^7.8.3", | 104 | "@babel/plugin-syntax-import-meta": "^7.8.3", |
| 105 | "@babel/plugin-transform-runtime": "^7.8.3", | 105 | "@babel/plugin-transform-runtime": "^7.8.3", |
| 106 | - "@babel/polyfill": "^7.8.3", | 106 | + "@babel/polyfill": "^7.8.7", |
| 107 | - "@babel/preset-env": "^7.8.6", | 107 | + "@babel/preset-env": "^7.8.7", |
| 108 | "@babel/register": "^7.8.6", | 108 | "@babel/register": "^7.8.6", |
| 109 | - "@babel/runtime": "^7.8.4", | 109 | + "@babel/runtime": "^7.8.7", |
| 110 | "ajv": "^6.12.0", | 110 | "ajv": "^6.12.0", |
| 111 | "babel-eslint": "^9.0.0", | 111 | "babel-eslint": "^9.0.0", |
| 112 | "babel-loader": "^8.0.6", | 112 | "babel-loader": "^8.0.6", |
| ... | @@ -115,10 +115,10 @@ | ... | @@ -115,10 +115,10 @@ |
| 115 | "chalk": "^3.0.0", | 115 | "chalk": "^3.0.0", |
| 116 | "clean-webpack-plugin": "^3.0.0", | 116 | "clean-webpack-plugin": "^3.0.0", |
| 117 | "copy-webpack-plugin": "^5.1.1", | 117 | "copy-webpack-plugin": "^5.1.1", |
| 118 | - "cross-env": "^7.0.1", | 118 | + "cross-env": "^7.0.2", |
| 119 | "css-loader": "^3.4.2", | 119 | "css-loader": "^3.4.2", |
| 120 | "del": "^5.1.0", | 120 | "del": "^5.1.0", |
| 121 | - "electron": "^8.0.3", | 121 | + "electron": "^8.1.0", |
| 122 | "electron-builder": "^22.3.6", | 122 | "electron-builder": "^22.3.6", |
| 123 | "electron-devtools-installer": "^2.2.4", | 123 | "electron-devtools-installer": "^2.2.4", |
| 124 | "eslint": "^6.8.0", | 124 | "eslint": "^6.8.0", |
| ... | @@ -132,6 +132,8 @@ | ... | @@ -132,6 +132,8 @@ |
| 132 | "eslint-plugin-standard": "^4.0.0", | 132 | "eslint-plugin-standard": "^4.0.0", |
| 133 | "express": "^4.17.1", | 133 | "express": "^4.17.1", |
| 134 | "file-loader": "^5.1.0", | 134 | "file-loader": "^5.1.0", |
| 135 | + "happypack": "^5.0.1", | ||
| 136 | + "hard-source-webpack-plugin": "^0.13.1", | ||
| 135 | "html-webpack-plugin": "^3.2.0", | 137 | "html-webpack-plugin": "^3.2.0", |
| 136 | "mini-css-extract-plugin": "0.9.0", | 138 | "mini-css-extract-plugin": "0.9.0", |
| 137 | "multispinner": "^0.2.1", | 139 | "multispinner": "^0.2.1", | ... | ... |
| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | <% if (!process.browser) { %> | 16 | <% if (!process.browser) { %> |
| 17 | <script> | 17 | <script> |
| 18 | if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\') | 18 | if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\') |
| 19 | + if (process.env.NODE_ENV !== 'development') window.__lib = require('path').join(__dirname, `../../../../${require('../config/index.js').DllFolder}`).replace(/\\/g, '\\\\') | ||
| 19 | </script> | 20 | </script> |
| 20 | <% } %> | 21 | <% } %> |
| 21 | 22 | ... | ... |
| ... | @@ -73,9 +73,11 @@ export default { | ... | @@ -73,9 +73,11 @@ export default { |
| 73 | ], | 73 | ], |
| 74 | dialogVisible: false, | 74 | dialogVisible: false, |
| 75 | progressStaus: null, | 75 | progressStaus: null, |
| 76 | - filePath: "" | 76 | + filePath: "", |
| 77 | }), | 77 | }), |
| 78 | - created() {}, | 78 | + created() { |
| 79 | + console.log(__lib) | ||
| 80 | + }, | ||
| 79 | methods: { | 81 | methods: { |
| 80 | // 获取electron方法 | 82 | // 获取electron方法 |
| 81 | open() { | 83 | open() { | ... | ... |
| ... | @@ -26,6 +26,10 @@ | ... | @@ -26,6 +26,10 @@ |
| 26 | <div class="name">所运行的系统:</div> | 26 | <div class="name">所运行的系统:</div> |
| 27 | <div class="value">{{ platform }}</div> | 27 | <div class="value">{{ platform }}</div> |
| 28 | </div> | 28 | </div> |
| 29 | + <div class="item"> | ||
| 30 | + <div class="name">所运行的系统:</div> | ||
| 31 | + <div class="value">{{ arch }}位</div> | ||
| 32 | + </div> | ||
| 29 | </div> | 33 | </div> |
| 30 | </div> | 34 | </div> |
| 31 | </template> | 35 | </template> |
| ... | @@ -39,6 +43,7 @@ | ... | @@ -39,6 +43,7 @@ |
| 39 | node: process.versions.node, | 43 | node: process.versions.node, |
| 40 | path: this.$route.path, | 44 | path: this.$route.path, |
| 41 | platform: require('os').platform(), | 45 | platform: require('os').platform(), |
| 46 | + arch:require('os').arch(), | ||
| 42 | vue: require('vue/package.json').version | 47 | vue: require('vue/package.json').version |
| 43 | } | 48 | } |
| 44 | }, | 49 | }, | ... | ... |
-
请 注册 或 登录 后发表评论