forked from TiysEvgeny/reactjs-18.11
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
59 lines (57 loc) · 1.98 KB
/
webpack.config.js
File metadata and controls
59 lines (57 loc) · 1.98 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src', 'index.jsx'),
devtool: 'eval-source-map', // отображение правильной карты в консоле при ошибке, перед продакшеном отключить, т.к. замедляет загрузку, увеличивает bundle!
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx'], // Какие файлы искать при импорте. Очерёдность по приоритету
alias: {
components: path.resolve(__dirname, 'src', 'components'), // Папки в которых следует искать компоненты
assets: path.resolve(__dirname, 'src', 'assets'),
pages: path.resolve(__dirname, 'src', 'pages'),
actions: path.resolve(__dirname, 'src', 'actions'),
reducers: path.resolve(__dirname, 'src', 'reducers'),
containers: path.resolve(__dirname, 'src', 'containers'),
middlewares: path.resolve(__dirname, 'src', 'middlewares'),
}
},
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.s?css$/,
use: [
// 'style-loader', // Если не закомментить происходит ошибка при сборке!
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'index.html'),
filename: 'index.html'
}),
new MiniCssExtractPlugin({
filename: 'main.css',
})
],
devServer: {
historyApiFallback: true,
// port: 8080,
// historyApiFallback: {
// index: 'index.html'
// }
}
};