-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (47 loc) · 1.46 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
50
var gulp = require('gulp');
var path = require('path');
var gutil = require("gulp-util");
var webpack = require("webpack");
var sass = require('gulp-sass');
var WebpackDevServer = require("webpack-dev-server");
gulp.task('default', function(done) {
webpack(webpackConfig, function(err, stats) {
if (err) {
throw new gutil.PluginError('webpack', err);
}
gutil.log('[default]', stats.toString());
done();
});
});
gulp.task("webpack-dev", function(callback) {
var compiler = webpack(webpackConfig);
new WebpackDevServer(compiler, {
// server and middleware options
}).listen(8080, "localhost", function(err) {
if(err) throw new gutil.PluginError("webpack-dev", err);
gutil.log("[webpack-dev]", "http://localhost:8080/webpack-dev-server/index.html");
// callback();
});
});
var webpackConfig = {
context: path.resolve('.'),
entry: 'gameasm.ts',
output: {
path: path.resolve('.'),
publicPath: '/',
filename: 'gameasm.js'
},
resolve: {
root: [path.resolve('.')],
extensions: ['', '.js', '.jsx', '.ts', '.tsx'] // For CommonJS syntax will attempt to resolve all these extensions for require statements.
},
module: {
loaders: [
{test: /\.tsx?$/, loader: 'ts-loader'} // All files with a `.ts` or `.tsx` extension will be handled by `ts-loader`.
]
},
plugins: [
// For now, remove this to get non-ugly output. TODO: Make this configurable.
// new webpack.optimize.UglifyJsPlugin({})
]
};