diff --git a/webpack.electron.babel.ts b/webpack.electron.babel.ts index 2b519bfb..8794b69c 100644 --- a/webpack.electron.babel.ts +++ b/webpack.electron.babel.ts @@ -1,5 +1,6 @@ -import path from 'path'; -import CopyPlugin from 'copy-webpack-plugin'; +import CopyPlugin from 'copy-webpack-plugin' +import path from 'path' +const Dotenv = require('dotenv-webpack') export default { resolve: { @@ -10,32 +11,41 @@ export default { target: 'electron-main', stats: 'errors-only', module: { - rules: [{ - test: /\.(js|ts|tsx)$/, - exclude: /node_modules/, - use: { - loader: 'babel-loader', + rules: [ + { + test: /\.(js|ts|tsx)$/, + exclude: /node_modules/, + use: { + loader: 'babel-loader', + }, }, - }, { - test: /\.svg$/, - issuer: /\.[jt]sx?$/, - use: ['@svgr/webpack', 'url-loader'], - }, { - test: /\.(gif|png|jpe?g|ico|icns)$/i, - type: 'asset/resource', - }], + { + test: /\.svg$/, + issuer: /\.[jt]sx?$/, + use: ['@svgr/webpack', 'url-loader'], + }, + { + test: /\.(gif|png|jpe?g|ico|icns)$/i, + type: 'asset/resource', + }, + ], }, output: { path: path.resolve(__dirname, './build/electron'), filename: '[name].js', - hashFunction: "sha256", + hashFunction: 'sha256', }, plugins: [ + new Dotenv({ + path: './.env', + }), new CopyPlugin({ - patterns: [{ - from: path.resolve(__dirname, './src/electron/preload.js'), - to: path.resolve(__dirname, './build/electron'), - }], + patterns: [ + { + from: path.resolve(__dirname, './src/electron/preload.js'), + to: path.resolve(__dirname, './build/electron'), + }, + ], }), ], -}; \ No newline at end of file +}