-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
59 lines (57 loc) · 2.12 KB
/
webpack.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
const { IN_DIST } = require('./webpack.paths.js');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const devConfig = {
mode: 'development', // development optimizations
devtool: 'inline-source-map', // fast source-maps
devServer: {
contentBase: IN_DIST(),
open: true, // open browser
https: true, // use https
overlay: true, // display error overlay
hot: true, // enable hot module replacement
quiet: true, // use friendly errors plugin
stats: "errors-only", // display only errors to reduce the amount of output
host: "0.0.0.0", // access server externally
},
module: {
rules: [
{
test: /\.scss$/, // look for .scss files and apply loaders in reverse order
use: [
{
loader: 'style-loader', // load css as style tags for faster development
options: { sourceMap: true }
},
{
loader: 'css-loader', // convert to css
options: { sourceMap: true }
},
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: () => [
require('autoprefixer')() // autoprefix scss
]
}
},
{
loader: 'sass-loader', // transpile sass/scss syntax first
options: { sourceMap: true }
}
]
}
]
},
output: {
filename: '[name].bundle.js', // final outputed file
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // enable HMR through plugin
new FriendlyErrorsWebpackPlugin(),
]
};
module.exports = merge(common, devConfig);