forked from varbee/teamWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (63 loc) · 1.8 KB
/
webpack.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
var path = require('path'),
webpack = require('webpack'),
ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
index: [
'webpack-dev-server/client?http://localhost:8080/',
'./src/index.js'
]
},
output: {
path: path.join(__dirname, 'dist'), // webpack 本地打包路径
filename: "bundle.js",
// 线上发布路径,和path最好保持一致,html页面引入script路径
publicPath: '/dist/'
},
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
progress: true
},
devtool: '#eval-source-map',
module: {
loaders: [
{
test: /\.css$/,
// loader: 'style!css'
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
},
{
test: /\.scss$/,
loader: 'style!css!sass?sourceMap'
},
{
test: /\.js$/,
loader: 'babel',
// 可以单独在当前目录下配置.babelrc,也可以在这里配置
query: {
presets: ['es2015']
},
// 排除 node_modules 下不需要转换的文件,可以加快编译
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader?limit=8192'
},
{
test: /\.tpl$/,
loader: 'mustache'
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
"window.jQuery":"jquery"
}),
new ExtractTextPlugin('[name].css')
],
};