-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
44 lines (42 loc) · 1.17 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
let path = require('path');
let webpack = require('webpack');
let ExtractTextPlugin = require("extract-text-webpack-plugin");
let HtmlWebpackPlugin = require('html-webpack-plugin');
let PORT = 8080;
let dir = 'build-dev/';
module.exports = {
contentBase: dir,
devtool: 'eval',
port: PORT,
entry: [
'webpack-dev-server/client?http://localhost:' + PORT,
'webpack/hot/dev-server',
'./src/index.js'
],
output: {
path: path.resolve(__dirname, dir),
filename: 'js/index.js',
publicPath: ''
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot','babel'],
include: path.join(__dirname, 'src')
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!stylus-loader')
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader'
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin( 'css/styles.css', { allChunks: false }),
new HtmlWebpackPlugin({ template: './src/template/index.html', inject: false })
]
};