-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.dev.js
78 lines (76 loc) · 2.26 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: [
'eventsource-polyfill', // necessary for hot reloading with IE
'webpack-hot-middleware/client',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.js'
},
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss', '.sass']
},
plugins: [
/**
* This is where the magic happens! You need this to enable Hot Module Replacement!
*/
new webpack.HotModuleReplacementPlugin(),
/**
* NoErrorsPlugin prevents your webpack CLI from exiting with an error code if
* there are errors during compiling - essentially, assets that include errors
* will not be emitted. If you want your webpack to 'fail', you need to check out
* the bail option.
*/
new webpack.NoErrorsPlugin(),
/**
* DefinePlugin allows us to define free variables, in any webpack build, you can
* use it to create separate builds with debug logging or adding global constants!
* Here, we use it to specify a development build.
*/
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
/**
* TODO common
*/
new HtmlWebpackPlugin({
title: 'OpenWebNet',
filename: 'index.html',
template: 'index.template.html',
favicon: path.join(__dirname, 'dist/favicon.ico')
})
],
module: {
// use ! to chain loaders
loaders: [
{
test: /\.(js|jsx)$/,
exclude: [/node_modules/, /styles/],
loaders: ['babel'],
include: path.join(__dirname, 'src')
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader'
},
{
test: /\.sass/,
loader: 'style-loader!css-loader!postcss-loader!sass-loader?outputStyle=expanded&indentedSyntax'
},
{
test: /\.scss/,
loader: 'style-loader!css-loader!postcss-loader!sass-loader?outputStyle=expanded'
},
// inline base64 URLs for <=8k images, direct URLs for the rest
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'url-loader?limit=8192'
}
]
}
};