-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.base.js
More file actions
70 lines (67 loc) · 1.44 KB
/
webpack.config.base.js
File metadata and controls
70 lines (67 loc) · 1.44 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import path from 'path';
import { fileURLToPath } from 'url';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const mainConfig = {
target: 'electron-main',
entry: './main.js',
output: {
filename: 'main.bundle.js',
path: `${__dirname}/build`,
},
node: {
__dirname: false,
__filename: false,
},
externalsPresets: { node: true },
resolve: {
extensions: ['.js'],
},
externals: {
ssh2: 'commonjs ssh2',
},
};
export const rendererConfig = {
target: 'web',
entry: './app/index.jsx',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules|__tests__|jest\.config\.js/,
loader: 'babel-loader',
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
type: 'asset',
},
{
test: /\.node$/,
loader: 'node-loader',
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'app/index.html', to: 'index.html' },
],
}),
new MiniCssExtractPlugin({
filename: 'style.css',
}),
],
output: {
path: `${__dirname}/build`,
filename: 'bundle.js',
},
resolve: {
extensions: ['.js', '.jsx'],
},
};