-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
97 lines (96 loc) · 3.07 KB
/
webpack.config.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
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
94
95
96
97
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const autoprefixer = require('autoprefixer')
const path = require('path')
module.exports = {
resolve: {
extensions: ['*', '.js', '.jsx', '.json'],
alias: {
Styles: path.resolve(__dirname, './src/styles'),
Components: path.resolve(__dirname, './src/components'),
Containers: path.resolve(__dirname, './src/containers'),
Consts: path.resolve(__dirname, './src/consts'),
Actions: path.resolve(__dirname, './src/actions'),
Reducers: path.resolve(__dirname, './src/reducers'),
Utils: path.resolve(__dirname, './src/utils'),
},
},
entry: [
'./src/webpack-public-path',
'react-hot-loader/patch',
'webpack-hot-middleware/client?reload=true',
path.resolve(__dirname, './src/index.js'),
],
devtool: 'eval-source-map',
target: 'web',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: 'bundle.js',
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
__DEV__: true,
}),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: 'src/index.ejs',
minify: {
removeComments: true,
collapseWhitespace: true,
},
inject: true,
}),
new webpack.LoaderOptionsPlugin({
minimize: false,
debug: true,
noInfo: true, // set to false to see a list of every file being bundled.
options: {
sassLoader: {
includePaths: [path.resolve(__dirname, 'src', 'scss')],
},
context: '/',
postcss: () => [autoprefixer],
},
}),
],
module: {
rules: [
{
test: /\.(jpe?g|png|gif|ico)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
{
test: /\.js?$/,
exclude: /node_modules/,
loaders: ['babel-loader'],
},
{
test: /\.(css|scss|sass)$/,
loaders: [
'style-loader',
{
loader: 'css-loader?sourceMap',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[local]__[hash:base64:5]',
camelCase: true,
minimize: false,
},
},
'postcss-loader',
'sass-loader?sourceMap',
],
},
],
},
}