-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.conf.js
54 lines (49 loc) · 1.15 KB
/
webpack.conf.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
var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var path = require('path');
var LiveReloadPlugin = require('webpack-livereload-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var serverConfig = {
resolve: {
modules: [path.join(__dirname, '/backend'), path.join(__dirname, '/node_modules')],
extensions: ['.ts', '.js']
},
module: {
loaders: [
{
test: /\.ts$/,
loader: 'awesome-typescript-loader'
}
]
},
plugins: [
new LiveReloadPlugin(),
new webpack.HotModuleReplacementPlugin()
],
context: __dirname,
output: {
path: path.join(__dirname, 'dist'),
filename: 'server.js',
publicPath: path.resolve(__dirname)
},
target: 'node',
entry: path.join(__dirname,'backend','app'),
externals: checkNodeImport,
node: {
global: true,
__dirname: false,
__filename: false,
process: true,
Buffer: true
}
}
// Helpers
function checkNodeImport(context, request, cb) {
if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
cb(null, 'commonjs ' + request); return;
}
cb();
}
module.exports = [
serverConfig
]