-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.dev.js
86 lines (85 loc) · 2.03 KB
/
webpack.config.dev.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
79
80
81
82
83
84
85
86
const path = require('path');
const yaml = require('yamljs');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const Dotenv = require('dotenv-webpack');
module.exports = {
mode: 'development',
entry: './src/index.tsx',
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.tsx?$/i,
exclude: /node_modules/,
use: 'ts-loader',
},
{
test: /\.jsx?$/i,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.(png|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
},
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
{
test: /\.yaml$/i,
type: 'json',
parser: {
parse: yaml.parse,
},
},
],
},
resolve: {
extensions: ['.js', '.json', '.jsx', '.ts', '.tsx', '.css'],
alias: {
'@/components': path.resolve(__dirname, 'src/components/'),
'@/pages': path.resolve(__dirname, 'src/pages/'),
'@/hooks': path.resolve(__dirname, 'src/hooks/'),
'@/types': path.resolve(__dirname, 'src/types/'),
'@/atoms': path.resolve(__dirname, 'src/atoms/'),
'@/utils': path.resolve(__dirname, 'src/utils/'),
'@/constants': path.resolve(__dirname, 'src/constants/'),
'@/styles': path.resolve(__dirname, 'src/styles/'),
'@/assets': path.resolve(__dirname, 'public/assets/'),
},
},
devtool: 'source-map',
devServer: {
compress: true,
historyApiFallback: true,
hot: true,
},
plugins: [
new HTMLWebpackPlugin({
title: 'Moiza project',
template: './src/index.html',
}),
new Dotenv(),
],
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
},
};