-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.prod.config.js
executable file
·59 lines (55 loc) · 1.13 KB
/
webpack.prod.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
// Webpack config for creating the production bundle.
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const assetsPath = path.join(__dirname, 'build');
module.exports = {
devtool: 'source-map',
mode: 'production',
entry: [
'./js/index.tsx'
],
output: {
path: assetsPath,
filename: '[name].js',
chunkFilename: '[name]-[chunkhash].js',
publicPath: '/dist/'
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
module: {
rules: [
{
test: /\.(jpe?g|png|gif|svg)$/,
loader: 'url-loader',
options: {limit: 10240}
},
{
test: /\.tsx?$/,
use: ['ts-loader']
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
'postcss-loader'
]
}
]
},
plugins: [
new MiniCssExtractPlugin({filename: "[name].css"}),
new webpack.DefinePlugin({
__CLIENT__: true,
__SERVER__: false,
__DEVELOPMENT__: false,
__DEVTOOLS__: false
}),
// ignore dev config
new webpack.IgnorePlugin({resourceRegExp: /\.\/dev/, contextRegExp: /\/config$/})
]
};