Skip to content

Commit

Permalink
Upgrade the default versions of Vue (2.5.10 -> 2.15.3 +) and electron…
Browse files Browse the repository at this point in the history
… (1.7.5 + -> 13.1.6 +) components
  • Loading branch information
qianmoQ committed Jul 14, 2021
1 parent 760e6fc commit 81d4b9d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 12 deletions.
17 changes: 14 additions & 3 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,28 @@ let rendererConfig = {
new webpack.DefinePlugin({
'process.env': process.env.NODE_ENV === 'production' ? config.build.env : config.dev.env
}),
// Webpack ReferenceError: process is not defined see #871 (https://github.com/SimulatedGREG/electron-vue/issues/871)
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
templateParameters(compilation, assets, options) {
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options
},
process,
};
},
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true
},
nodeModules: process.env.NODE_ENV !== 'production'
? path.resolve(__dirname, '../node_modules')
: false
nodeModules: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
Expand Down
12 changes: 12 additions & 0 deletions .electron-vue/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ let webConfig = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
templateParameters(compilation, assets, options) {
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options
},
process,
};
},
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@
"axios": "0.17.1",
"codemirror": "^5.61.0",
"echarts": "^5.1.2",
"element-ui": "2.3.4",
"es6-promise": "4.2.8",
"highcharts": "^9.1.2",
"highcharts-vue": "^1.4.0",
"js-cookie": "^2.2.0",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"vue": "2.5.10",
"vue-electron": "^1.0.6",
"vue-i18n": "^8.24.5",
"vue-router": "3.0.1",
"vuex": "3.0.1"
"vuex": "3.0.1",
"element-ui": "^2.15.3",
"vue": "^2.6.14"
},
"devDependencies": {
"babel-core": "^6.25.0",
Expand All @@ -92,8 +94,8 @@
"css-loader": "^0.28.4",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^1.7.5",
"electron-builder": "^19.19.1",
"electron": "^13.1.6",
"electron-builder": "^22.11.7",
"electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0",
"eslint": "^4.4.1",
Expand All @@ -110,10 +112,11 @@
"style-loader": "^0.18.2",
"svg-sprite-loader": "3.5.2",
"url-loader": "^0.5.9",
"vue": "^2.6.14",
"vue-html-loader": "^1.2.4",
"vue-loader": "^13.0.5",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "2.5.10",
"vue-template-compiler": "^2.6.14",
"webpack": "^3.5.2",
"webpack-dev-server": "^2.7.1",
"webpack-hot-middleware": "^2.18.2"
Expand Down
20 changes: 17 additions & 3 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, Menu } from 'electron'
import { app, BrowserWindow, Menu, globalShortcut } from 'electron'

/**
* Set `__static` path to static files in production
Expand All @@ -21,7 +21,12 @@ function createWindow() {
height: 563,
useContentSize: true,
width: 1000,
webPreferences: { webSecurity: false }
webPreferences: {
webSecurity: false,
nodeIntegration: true,
// uncaught referenceerror module is not defined see https://stackoverflow.com/questions/66506331/electron-nodeintegration-not-working-also-general-weird-electron-behavior
contextIsolation: false
}
})

// Support copy and paste on mac
Expand Down Expand Up @@ -96,7 +101,16 @@ app.setAboutPanelOptions({
website: config.github
})

app.on('ready', createWindow)
app.on('ready', () => {
if (mainWindow == null) {
createWindow()
}
// Turn on debug mode
globalShortcut.register('CommandOrControl+Shift+L', () => {
const focusWin = BrowserWindow.getFocusedWindow()
focusWin && focusWin.toggleDevTools()
})
})

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Vue.component('font-awesome-icon', FontAwesomeIcon)
// Support i18n
import { i18n } from './i18n'

// Support highcharts
import HighchartsVue from 'highcharts-vue'
Vue.use(HighchartsVue)

Expand Down

0 comments on commit 81d4b9d

Please sign in to comment.