-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
147 lines (138 loc) · 3.68 KB
/
webpack.config.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
"use strict";
const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const EventHooksPlugin = require('event-hooks-webpack-plugin');
const shebangLoader = require('shebang-loader');
const commonConfig = {
node: {
__dirname: false,
__filename: false
},
mode : "development",
// Set debugging source maps to be "inline" for
// simplicity and ease of use
devtool: "inline-source-map",
// Where to compile the bundle
// By default the output directory is `dist`
// Supported file loaders
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: ["shebang-loader"]
},
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
loader: ["ts-loader"]
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}
]
},
{
test: /\.(png|jpe?g|gif)$/i,
use: {
loader : 'file-loader',
options : {
name : '[name].[ext]',
outputPath: 'images/'
}
}
},
{
test: /\.node$/,
use: 'node-loader'
}
]
},
// File extensions to support resolving
resolve: {
extensions: [".ts", ".tsx", ".js" , ".css" , ".png"],
},
externals: [nodeExternals({
whitelist: [/\.css/]
})],
};
module.exports = [
Object.assign(
{
target: 'electron-main',
entry: { main: './src/main.ts' },
output: {
path: path.resolve(__dirname, '.'),
filename: '[name].js'
},
},
commonConfig),
Object.assign(
{
target : 'electron-renderer',
entry: {
renderer: './src/renderer.tsx',
thread : './src/threads/CryptoThread.ts',
},
plugins: [new HtmlWebpackPlugin({
template : "./app/index.html",
}),
new HtmlWebpackPlugin({
template : "./app/empty.html",
})],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
},
commonConfig),
Object.assign(
{
target : 'electron-preload',
entry: { preload: './src/preload.ts' },
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
},
commonConfig),
Object.assign(
{
target : 'node',
entry: {
release : './src/cli/release.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
},
commonConfig),
Object.assign(
{
target : 'node',
entry: {
dh : './src/tests/DH.ts',
logitsic : './src/tests/Logistic.ts',
henon : './src/tests/Henon.ts',
general : './src/tests/General.ts',
},
output: {
path: path.resolve(__dirname, 'dist/tests'),
filename: '[name].js'
},
},
commonConfig),
]