-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
96 lines (94 loc) · 2.73 KB
/
Copy pathwebpack.dev.config.js
File metadata and controls
96 lines (94 loc) · 2.73 KB
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
88
89
90
91
92
93
94
95
96
const path = require("path");
const webpack = require("webpack")
const dotenv = require("dotenv")
const Dotenv = require('dotenv-webpack');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const {CleanWebpackPlugin} = require("clean-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
mode: 'production',
entry: './src/index.tsx',
output: {
path: path.join(__dirname, "/build"),
filename: '[name].bundle.js',
clean: true
},
optimization: {
minimize: false,
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: "babel-loader"
},
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: 'ts-loader'
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
},
{
test: /\.(jpe?g|png|gif|svg|ico)$/i,
use: ['file-loader?name=[name].[ext]']
},
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: "./public/index.html",
filename: './index.html',
manifest: "./public/manifest.json",
favicon: './public/favicon.ico'
}),
new Dotenv({
path: './.dev.env'
}),
new ImageMinimizerPlugin({
minimizerOptions: {
plugins: [
['gifsicle', { interlaced: true }],
['jpegtran', { progressive: true }],
['optipng', { optimizationLevel: 5 }],
],
},
}),
new MiniCssExtractPlugin(),
new CompressionPlugin(),
],
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
devServer : {
open:true,
allowedHosts: 'auto',
https: false,
hot: true,
port: 9000,
liveReload: true
}
}