-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
72 lines (70 loc) · 1.81 KB
/
webpack.config.dev.js
File metadata and controls
72 lines (70 loc) · 1.81 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import webpack from 'webpack';
import path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
let HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
title: 'ChingChingTest',
template: __dirname + '/src/index.html',
filename: 'index.html',
inject: 'body'
});
export default {
debug: true,
devtool: 'inline-source-map',
noInfo: false,
entry: [
'eventsource-polyfill', // necessary for hot reloading with IE
'webpack-hot-middleware/client?reload=true', //note that it reloads the page if hot module reloading fails.
path.resolve(__dirname, 'src/index.js')
],
target: 'web',
output: {
path: __dirname + '/dist', // Note: Physical files are only output by the production build task `npm run build`.
publicPath: '/',
filename: 'bundle.js'
},
devServer: {
contentBase: path.resolve(__dirname, 'src')
},
plugins: [
HtmlWebpackPluginConfig,
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('css/main.css', {
allChunks: true
})
],
module: {
loaders: [
{
test: /(\.jsx?$|\.js$)/,
include: path.join(__dirname, 'src'),
exclude: /(node_modules)/,
loaders: ['babel']
},
{
test : /\.css$/,
loader: "style-loader!css-loader?sourceMap"
},
{
test: /(\.sass$|\.scss$)/,
loader: ExtractTextPlugin.extract(
'style', // The backup style loader
'css?sourceMap!sass?sourceMap&includePaths[]=./sass',
{ publicPath: '../'}
)
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?\S*)?$/,
loader: "file-loader?name=fonts/[name].[ext]"
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?name=img/[name].[ext]&context=./img',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
}
]
}
};