diff --git a/_scripts/webpack.renderer.config.js b/_scripts/webpack.renderer.config.js index b6085d4a..d1a9287d 100644 --- a/_scripts/webpack.renderer.config.js +++ b/_scripts/webpack.renderer.config.js @@ -109,7 +109,10 @@ const config = { global: isDevMode, }, plugins: [ - // new WriteFilePlugin(), + new webpack.DefinePlugin({ + 'process.env.PRODUCT_NAME': JSON.stringify(productName), + 'process.env.IS_ELECTRON': true + }), new HtmlWebpackPlugin({ excludeChunks: ['processTaskWorker'], filename: 'index.html', @@ -119,9 +122,6 @@ const config = { : false, }), new VueLoaderPlugin(), - new webpack.DefinePlugin({ - 'process.env.PRODUCT_NAME': JSON.stringify(productName), - }), new MiniCssExtractPlugin({ filename: isDevMode ? '[name].css' : '[name].[contenthash].css', chunkFilename: isDevMode ? '[id].css' : '[id].[contenthash].css', diff --git a/_scripts/webpack.web.config.js b/_scripts/webpack.web.config.js index 27320cb4..bafdf9b7 100644 --- a/_scripts/webpack.web.config.js +++ b/_scripts/webpack.web.config.js @@ -119,7 +119,10 @@ const config = { dns: 'empty' }, plugins: [ - // new WriteFilePlugin(), + new webpack.DefinePlugin({ + 'process.env.PRODUCT_NAME': JSON.stringify(productName), + 'process.env.IS_ELECTRON': false + }), new HtmlWebpackPlugin({ excludeChunks: ['processTaskWorker'], filename: 'index.html', @@ -127,9 +130,6 @@ const config = { nodeModules: false, }), new VueLoaderPlugin(), - new webpack.DefinePlugin({ - 'process.env.PRODUCT_NAME': JSON.stringify(productName), - }), new MiniCssExtractPlugin({ filename: isDevMode ? '[name].css' : '[name].[contenthash].css', chunkFilename: isDevMode ? '[id].css' : '[id].[contenthash].css', diff --git a/src/datastores/handlers/index.js b/src/datastores/handlers/index.js index 0b1dc938..e96565d1 100644 --- a/src/datastores/handlers/index.js +++ b/src/datastores/handlers/index.js @@ -1,6 +1,5 @@ let handlers -const usingElectron = window?.process?.type === 'renderer' -if (usingElectron) { +if (process.env.IS_ELECTRON) { handlers = require('./electron').default } else { handlers = require('./web').default diff --git a/src/index.ejs b/src/index.ejs index f0dad7e0..e1f4040e 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -21,7 +21,7 @@