-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
103 lines (97 loc) · 2.02 KB
/
webpack.config.js
File metadata and controls
103 lines (97 loc) · 2.02 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
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
const path = require('path');
const dotenv = require('dotenv');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
dotenv.config();
const rootDirs = [
path.resolve(__dirname, 'src'),
];
module.exports = {
entry: [
'./src/app/index.tsx',
],
target: 'electron-renderer',
mode: process.env.APP_ENV,
devtool: 'source-map',
output: {
filename: 'app.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
globalObject: 'this',
},
resolve: {
extensions: [ '.tsx', '.ts', '.js', '.jsx' ],
alias: {
'~': path.resolve(__dirname, 'src/app'),
},
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'public/index.html',
}),
new CopyWebpackPlugin([{ from: 'src/app/fonts', to: 'fonts' }]),
],
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
terserOptions: {
ecma: 6,
},
}),
],
},
module: {
rules: [
{
test: /\.tsx?$/,
include: rootDirs,
use: [
'babel-loader',
'awesome-typescript-loader',
],
},{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
],
}, {
test: /\.svg|jpg|png$/,
use: [
{
loader: 'file-loader',
options: {
name: 'images/[name]-[hash].[ext]',
},
},
],
}, {
test: /\.yml$/,
use: [
{
loader: 'json-loader',
options: {
type: 'javascript/auto',
},
},
{
loader: 'yaml-loader',
},
],
}, {
test: /\.ttf$/,
use: [
{
loader: 'file-loader',
options: {
name: 'fonts/[name]-[hash].[ext]',
},
},
],
},
],
},
};