-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
77 lines (75 loc) · 2.2 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
/* eslint-disable no-unused-vars */
const HtmlWebpackPlugin = require('html-webpack-plugin')
const nodeExternals = require('webpack-node-externals')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const path = require('path')
const alias = {
src: path.resolve(__dirname, 'src/'),
utils: path.resolve(__dirname, 'src/utils/'),
}
module.exports = (env, args) => [
{
mode: env === 'prod' ? 'production' : 'development',
entry: './src/app.tsx',
target: 'electron-renderer',
devtool: env === 'prod' ? undefined : 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias,
},
module: {
rules: [
{
test: /\.ts(x?)$/,
include: /src/,
use: [{ loader: 'ts-loader' }],
},
{
test: /\.less$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'less-loader' }],
},
{
test: /\.glsl$/,
use: [{ loader: 'webpack-glsl-loader' }],
},
],
},
output: {
path: __dirname + '/app',
filename: 'bundle.js',
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
}),
],
},
{
mode: env === 'prod' ? 'production' : 'development',
entry: './src/main.ts',
target: 'electron-main',
devtool: env === 'prod' ? undefined : 'source-map',
resolve: {
extensions: ['.ts', '.js'],
alias,
},
externals: [nodeExternals()],
devServer: {
contentBase: 'app/',
},
module: {
rules: [
{
test: /\.ts$/,
include: /src/,
use: [{ loader: 'ts-loader' }],
},
],
},
plugins: [new CopyWebpackPlugin([{ from: 'static/', to: 'static' }])],
output: {
path: __dirname + '/app',
filename: 'main.js',
},
},
]