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

module.exports = {
	entry: path.resolve(__dirname, '../src/client/main.ts'),
	output: {
		filename: 'bundle.js',
		path: path.resolve(__dirname, '../dist/client'),
	},
	target: 'web',
	resolve: {
		extensions: ['.ts', '.tsx', '.js', '.json', '.glsl', '.frag', '.vert']
	},
	module: {
		rules: [{
			test: /\.tsx?$/,
			loader: 'babel-loader',
			include: path.join(__dirname, '../src/client'),
		},{
			test: /\.(frag|vert|glsl)$/,
			loader: 'glsl-shader-loader',
			include: path.join(__dirname, '../src/client/shaders'),
		}],
	},
	plugins: [
		new EsLint({
			extensions: ['.ts', '.tsx'],
			context: path.join(__dirname, '../src/client'),
		}),
	],
};
