forked from Xetrn/stellar-burgers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
94 lines (93 loc) · 2.18 KB
/
webpack.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
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
const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Dotenv = require('dotenv-webpack');
module.exports = {
entry: path.resolve(__dirname, './src/index.tsx'),
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.(ts)x?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader'
}
},
{
test: /\.css$/,
exclude: /\.module\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.module\.css$/i,
exclude: /node_modules/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true
}
}
]
},
{
test: /\.(jpg|jpeg|png|svg)$/,
type: 'asset/resource'
},
{
test: /\.(woff|woff2)$/,
type: 'asset/resource'
}
]
},
plugins: [
new ESLintPlugin({
extensions: ['.js', '.jsx', '.ts', '.tsx']
}),
new HtmlWebpackPlugin({
template: './public/index.html'
}),
new Dotenv()
],
resolve: {
extensions: [
'*',
'.js',
'.jsx',
'.ts',
'.tsx',
'.json',
'.css',
'.scss',
'.png',
'.svg',
'.jpg'
],
alias: {
'@pages': path.resolve(__dirname, './src/pages'),
'@components': path.resolve(__dirname, './src/components'),
'@ui': path.resolve(__dirname, './src/components/ui'),
'@ui-pages': path.resolve(__dirname, './src/components/ui/pages'),
'@utils-types': path.resolve(__dirname, './src/utils/types'),
'@api': path.resolve(__dirname, './src/utils/burger-api.ts'),
'@slices': path.resolve(__dirname, './src/services/slices'),
'@selectors': path.resolve(__dirname, './src/services/selectors')
}
},
output: {
path: path.resolve(__dirname, './dist'),
filename: 'bundle.js'
},
devServer: {
static: path.join(__dirname, './dist'),
compress: true,
historyApiFallback: true,
port: 4000
}
};