-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
64 lines (60 loc) · 1.56 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
/*
* @Author: tengfeisu
* @Date: 2016-07-13 17:29:03
* @Last Modified by: tengfeisu
* @Last Modified time: 2016-07-13 17:48:56
*/
'use strict';
var path = require('path');
var webpack = require('webpack');
var HtmlwebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://127.0.0.1:8080',
'webpack/hot/dev-server',
'./src/js/index',
'./src/js/a',
'./src/less/main.less'
],
output: {
path: path.join(__dirname, 'build'),
filename: '/js/[name].js'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlwebpackPlugin({
title: 'Hello World app',
filename: 'html/index.html',
template: 'src/html/index.html',
inject: true,
hash: true
}),
new ExtractTextPlugin("index.css")
],
module: {
loaders: [
//.css 文件使用 style-loader 和 css-loader 来处理
{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
'css?sourceMap!' +
'less?sourceMap'
)
},
{
test: /\.js$/,
loader: 'babel'
},
{
test: /.(png|jpg)$/,
loader: 'url?limit=8192&name=images/[hash:8].[name].[ext]'
}
]
},
devServer: {
contentBase: './build',
hot: true
}
}