const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')

module.exports = {
	entry: './src/index.js',

	output: {
		filename: 'bundle.js',
		path: path.resolve(__dirname, 'dist')
	},

	plugins: [
		new CleanWebpackPlugin(['dist']),
		new HtmlWebpackPlugin({ template: 'assets/index.html' }),
		new CopyWebpackPlugin([{ from: 'assets/font/', to: 'font' }]),
	],

	module: {
		rules: [
			{
				test: /\.worker\.js$/,
				use: { loader: 'worker-loader', options: { inline: true } }
			},
			// {
			// 	test: /\.js$/,
			// 	exclude: /node_modules/,
			// 	loader: 'babel-loader'
			// }
		]
	},

	resolve: {
		modules: [path.resolve(__dirname, 'src'), 'node_modules']
	}
}
