const path = require('path');
const nodeExternals = require('webpack-node-externals');
const EsLint = require('eslint-webpack-plugin');

module.exports = {
	entry: path.resolve(__dirname, '../src/server/main.ts'),
	output: {
		filename: 'bundle.js',
		path: path.resolve(__dirname, '../dist/server'),
	},
	target: 'node',
	externals: [nodeExternals()],
	resolve: {
		extensions: ['.ts', '.tsx', '.js', '.json']
	},
	module: {
		rules: [{
			test: /\.tsx?$/,
			loader: 'babel-loader',
			include: path.join(__dirname, '../src/server'),
		}],
	},
	plugins: [
		new EsLint({
			extensions: ['.ts', '.tsx'],
			context: path.join(__dirname, '../src/server'),
		}),
	],
};