-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.dev.config.js
93 lines (92 loc) · 2.11 KB
/
webpack.dev.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
const HtmlWebPackPlugin = require("html-webpack-plugin");
const path = require('path');
const WebpackBar = require('webpackbar')
const src = path.join(__dirname, 'src')
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin')
module.exports = {
entry: path.join( src, 'index.js'),
output: {
path: path.join(__dirname, 'demo'),
filename:'react-valine.js'
},
resolve: {
extensions: [ '.js', '.json', '.jsx','.css','.scss'],
},
devtool: 'cheap-module-source-map',
module: {
rules: [
{
enforce:'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader"
},
{
test: /\.(js|jsx)$/,
include:path.resolve(__dirname, 'src'),
loader: 'babel-loader'
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader",
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
stage: 3,
}),
],
},
},
]
},
{
test: /\.scss$/,
use: [
"style-loader",
"css-loader",
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
stage: 3,
}),
],
},
},
"sass-loader"
]
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
}
]
},
plugins: [
new FriendlyErrorsWebpackPlugin(),
new ErrorOverlayPlugin(),
new WebpackBar(),
new HtmlWebPackPlugin({
template: "./index.html",
filename: "./index.html"
})
],
devServer: {
quiet:true,
hot: true,
} ,
};