-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
49 lines (44 loc) · 1.06 KB
/
app.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 node_mods = __dirname + '/node_modules';
var webpack = require("webpack");
var express = require('express');
var app = express();
var home = app.use(express.static('static'));
var compiler = webpack({
entry: ['./js/app.js'],
output: {
path: __dirname + '/static',
filename: 'bundle.js'
},
devServer: {
publicPath: "/static"
},
resolve: {
alias: {
'$': node_mods + '/jquery/dist/jquery.min.js',
'lodash': node_mods + '/lodash',
'd3': node_mods + '/d3/d3.min.js'
}
},
module: {
noParse: [
node_mods + '/jquery/dist/jquery.min.js',
node_mods + '/lodash',
node_mods + '/d3/d3.min.js'],
loaders: [
{ test: /\.js$/, loader: 'jsx-loader' }
]
}
});
compiler.run(function(err, stats) {
if (err) {
console.error(err);
}
});
app.get('/', function (req, res) {
res.send(home);
});
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('listening at http://%s:%s', host, port);
});