forked from xiaopangxie/wedding-Invitations
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.dev.config.js
73 lines (70 loc) · 1.86 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
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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var precss = require('precss');
var autoprefixer = require('autoprefixer');
// 项目根路径
var ROOT_PATH = path.join(__dirname, '..');
// 项目源码路径
var SRC_PATH = path.join(ROOT_PATH, 'src');
// 产出路径
var DIST_PATH = path.join(ROOT_PATH, 'dist');
module.exports = {
devtool: 'inline-source-map',
context: SRC_PATH,
entry: [
'webpack-hot-middleware/client',
'babel-polyfill',
'./index.js'
],
output: {
path: DIST_PATH,
filename: 'bundle.js',
<<<<<<< HEAD
publicPath: 'http://127.0.0.1:8081/'
=======
publicPath: '/public/'
>>>>>>> daily/1.0.0
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify('development')
}
}),
new HtmlWebpackPlugin({
title: 'Boot React',
template: path.join(SRC_PATH, 'index.html')
})
],
resolve: {
extensions: ['', '.js'],
root: SRC_PATH
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel?cacheDirectory'],
include: SRC_PATH
}, {
test: /\.(scss|css)$/,
loaders: ['style', 'css', 'postcss', 'sass']
}, {
test: /\.json/,
loaders: ['json-loader']
}, {
test: /\.(png|jpg|gif|svg)$/,
loader: 'url-loader?limit=8192'
}, {
test: /\.(mp3|ogg|m4a|ttf)$/,
loader: 'file'
}]
},
postcss: function () {
// css autoprefix
//css 自动添加浏览器内核前缀
return [precss, autoprefixer];
}
};