-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.js
68 lines (67 loc) · 1.7 KB
/
webpack.config.prod.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
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './app/index.tsx',
mode: 'production',
target: 'electron-renderer',
watch: false,
output: {
filename: './bundle.js',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
'@api': path.resolve(__dirname, 'app/api'),
'@actions': path.resolve(__dirname, 'app/actions'),
'@reducers': path.resolve(__dirname, 'app/reducers'),
'@states': path.resolve(__dirname, 'app/states'),
'@store': path.resolve(__dirname, 'app/store'),
'@containers': path.resolve(__dirname, 'app/containers'),
'@components': path.resolve(__dirname, 'app/components'),
'@hoc': path.resolve(__dirname, 'app/HOC'),
'@layout': path.resolve(__dirname, 'app/layout'),
},
},
node: {
__dirname: false,
__filename: false,
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: [{ loader: 'ts-loader' }],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
},
{
test: /\.html$/,
loader: 'html-loader',
options: {
minimize: true,
},
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
query: {
name: '[name].[ext]?[hash]',
},
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: './index.html',
filename: './index.html',
options: {
minify: true,
},
}),
new CopyWebpackPlugin([{ from: './package.json', to: './' }]),
],
};