-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.electron.babel.ts
51 lines (50 loc) · 1.06 KB
/
webpack.electron.babel.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import CopyPlugin from 'copy-webpack-plugin'
import path from 'path'
const Dotenv = require('dotenv-webpack')
export default {
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
devtool: 'source-map',
entry: './src/electron/main.tsx',
target: 'electron-main',
stats: 'errors-only',
module: {
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',
},
],
},
output: {
path: path.resolve(__dirname, './build/electron'),
filename: '[name].js',
hashFunction: 'sha256',
},
plugins: [
new Dotenv({
path: './.env',
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, './src/electron/preload.js'),
to: path.resolve(__dirname, './build/electron'),
},
],
}),
],
}