-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (44 loc) · 1.17 KB
/
gulpfile.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
var gulp = require("gulp");
var gutil = require("gulp-util");
var webpack = require("webpack");
var WebpackDevServer = require("webpack-dev-server");
var path = require('path');
gulp.task("webpack", function(callback) {
// run webpack
webpack({
entry: {
app: path.join( __dirname, "source/app.js")
vendor: ['react', 'react-dom']
},
resolve: {
root: path.join( __dirname, 'source'),
extentions: ['', '.js'],
modulesDirectories: ['node_modules', 'source']
},
output: {
path: path.join(__dirname, 'build'),
publicPath: '',
filename: '[name].js',
library: ['Example', '[name]'],
pathInfo: true
},
module: {
loaders: [
{test: /\.js?$/, exclude: /node_modules/, loader: 'babel?cacheDirectory'}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),
new HtmlWebpackPlugin({
inject: true,
template: 'source/index.html'
})
]
}, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
}));
callback();
});
});