-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.ts
72 lines (71 loc) · 2.51 KB
/
webpack.config.prod.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
import path from 'path'
import { CleanWebpackPlugin } from 'clean-webpack-plugin'
const webpackConfig = (): { output: { path: string; filename: string }; mode: string; devServer: { overlay: boolean; port: number; stats: { assets: boolean; children: boolean; chunks: boolean; warnings: boolean; timings: boolean; publicPath: boolean; version: boolean; hash: boolean; modules: boolean } }; entry: string; resolve: { extensions: string[]; alias: { components: string } }; plugins: any[]; module: { rules: ({ test: RegExp; use: { loader: string }; exclude: RegExp } | { test: RegExp; use: string[] } | { test: RegExp; use: string[] } | { test: RegExp; use: { loader: string; options: { name: string } }[] } | { test: RegExp; loader: string; options: { transpileOnly: boolean }; exclude: RegExp })[] } } => ({
entry: './src/index.tsx',
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
components: path.resolve(__dirname, './src/components/'),
},
},
output: {
path: path.join(__dirname, '/build'),
filename: 'bundle.js',
},
mode: 'production',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
},
},
],
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
exclude: /dist/,
},
],
},
devServer: {
port: 3000,
overlay: true,
stats: {
assets: false,
children: false,
chunks: false,
hash: false,
modules: false,
publicPath: false,
timings: false,
version: false,
warnings: true,
},
},
plugins: [new CleanWebpackPlugin()],
})
export default webpackConfig