This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
79 lines (77 loc) · 2.17 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
69
70
71
72
73
74
75
76
77
78
var webpack = require('webpack');
var path = require('path');
var atLoader = require('awesome-typescript-loader');
var HTMLWebpackPlugin = require('html-webpack-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: [
'./src/index.tsx'
],
output: {
publicPath: '/',
filename: 'app.js',
path: path.resolve('build')
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: ['node_modules']
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'awesome-typescript-loader',
options: {
silent:true,
useBabel: true,
useCache: true
}
}]
},
{
test: /\.html/,
use: [{
loader: 'html-loader'
}]
},
{
test: /\.(css|scss)$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
importLoaders: true,
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]'
}
},
{
loader: 'sass-loader'
}]
}
]
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode:"server",
openAnalyzer:true
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new atLoader.CheckerPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
sourceMap:true,
debug: false
}),
new HTMLWebpackPlugin({
template: './src/index.html'
})
]
};