-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
57 lines (52 loc) · 1.59 KB
/
webpack.config.dev.js
File metadata and controls
57 lines (52 loc) · 1.59 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
const path = require("path");
require("dotenv").config({ path: path.resolve(__dirname, ".env") });
const AutoPrefixer = require("autoprefixer");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const merge = require("webpack-merge");
const Webpack = require("webpack");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const webpackBaseConfig = require("./webpack.config.common");
const plugins = [new Webpack.LoaderOptionsPlugin({ minimize: false })];
if (process.env.WEBPACK_WITH_BUNDLE_ANALYZER === "true") {
plugins.unshift(new BundleAnalyzerPlugin({ openAnalyzer: false }));
}
module.exports = merge.smart(webpackBaseConfig, {
devtool: "cheap-eval-source-map",
mode: "development",
module: {
rules: [
{
test: /.scss$/,
exclude: /node_modules/,
loader: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
modules: true,
minimize: false,
sourceMap: true,
localIdentName: "[name]__[local]__[hash:base64:5]"
}
},
{
loader: "postcss-loader",
options: {
plugins: [AutoPrefixer({ browsers: "last 2 versions" })]
}
},
"sass-loader"
]
}
]
},
plugins,
devServer: {
historyApiFallback: true,
disableHostCheck: true,
open: process.env.WEBPACK_AUTOMATIC_OPEN_BROWSER === "true",
openPage: "", // https://github.com/webpack/webpack-dev-server/issues/972
host: "0.0.0.0",
port: 9090
}
});