-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
58 lines (57 loc) · 1.95 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
/**
* Created by Freax on 17-1-3.
* @blog http://www.myfreax.com
*/
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'webpack-hot-middleware/client?noInfo=false&reload=true', //require
path.resolve(__dirname, 'src/index.js') //entry
],
output: {
publicPath: "/", //require
path: path.resolve(__dirname, 'build'),
filename: 'app.bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015','stage-0']
}
},
{test: /\.less$/, loader: 'style-loader!css-loader!less-loader'}, // use ! to chain loaders
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'}, // inline base64 URLs for <=8k images, direct URLs for the rest
{test:/\.js$/,loader:'webpack-module-hot-accept'}
]
},
//devtool: 'eval-source-map',
// 第三方类库直接引用,不用打包
externals: {
"angular": "angular",
"angular-resource": "ngResource",
"$": "jQuery",
"fabric": 'fabric'
},
plugins: [
new ExtractTextPlugin("[name].css"),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html', //
inject:true
})
],
resolveLoader: { //指定解释器载入的路径,可以是bower,webComponent
root: path.join(__dirname, 'node_modules')
}
};