-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
87 lines (82 loc) · 2.23 KB
/
webpack.config.ts
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
import * as HtmlWebPackPlugin from 'html-webpack-plugin';
import * as WebappWebpackPlugin from 'webapp-webpack-plugin';
import * as webpack from 'webpack';
const babelLoaderConfig = {
loader: 'babel-loader',
options: {
babelrc: true,
cacheDirectory: true,
},
};
const tsLoaderConfig = {
loader: 'ts-loader',
};
const htmlLoaderConfig = {
loader: 'html-loader',
options: {minimize: true},
};
const config: webpack.Configuration = {
devServer: {
clientLogLevel: 'warning',
disableHostCheck: true,
historyApiFallback: true,
host: '0.0.0.0',
},
devtool: 'source-map',
module: {
rules: [
{
exclude: /node_modules/,
test: /\.ts(x?)$/,
use: [babelLoaderConfig, tsLoaderConfig],
},
{
exclude: /node_modules/,
test: /\.js(x?)$/,
use: [babelLoaderConfig],
},
{
test: /\.html$/,
use: [htmlLoaderConfig],
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
chunks: 'initial',
enforce: true,
name: 'vendor',
priority: 10,
test: /node_modules/,
},
},
},
},
plugins: [
new HtmlWebPackPlugin({
filename: './index.html',
template: './src/assets/index.html',
}),
new WebappWebpackPlugin({
favicons: {
icons: {
android: false, // Create Android homescreen icon. `boolean` or `{ offset, background, shadow }`
appleIcon: false, // Create Apple touch icons. `boolean` or `{ offset, background }`
appleStartup: false, // Create Apple startup images. `boolean` or `{ offset, background }`
coast: false, // Create Opera Coast icon. `boolean` or `{ offset, background }`
favicons: true, // Create regular favicons. `boolean`
firefox: false, // Create Firefox OS icons. `boolean` or `{ offset, background }`
windows: false, // Create Windows 8 tile icons. `boolean` or `{ background }`
yandex: false, // Create Yandex browser icon. `boolean` or `{ background }`
},
},
logo: './src/assets/wrench.svg',
}),
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
};
export default config;