-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
61 lines (60 loc) · 1.82 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
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const isDevServer = process.argv[1] && process.argv[1].indexOf('webpack-dev-server') !== -1;
const webpack = require('webpack');
module.exports = {
mode: 'development',
watch: true,
devtool: 'inline-source-map',
entry: './assets/js/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
// HotFix for css-hot-loader (reload only one module)
filename: 'bundle.js' + (isDevServer ? "" : "?v=[hash]"),
hotUpdateChunkFilename: 'js/hot/hot-update.js?v=[hash]',
hotUpdateMainFilename: 'js/hot/hot-update.json?v=[hash]',
},
module: {
rules: [
{
test: /\.scss$/,
use:[
"css-hot-loader",
MiniCssExtractPlugin.loader,
{
loader: "css-loader", options: {
sourceMap: true
}
},
{
loader: "sass-loader", options: {
sourceMap: true
}
},
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "bundle.css" + (isDevServer ? "" : "?v=[hash]"),
}),
new CleanWebpackPlugin(),
new webpack.HotModuleReplacementPlugin()
],
devServer: {
stats: "minimal",
publicPath: '/dist/',
hot: true,
inline: true,
host: "0.0.0.0",
port: 8080,
sockPort: 8081,
proxy: {
"*": "http://nginx:9000",
},
disableHostCheck: true
}
};