text: const {VueLoaderPlugin} = require('vue-loader');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const CompressionPlugin = require('compression-webpack-plugin');
  
  const dartSass = require('sass');
  
  const config = require('./config');
  
  module.exports = {
  	mode: 'development', // Run webpack -p to deploy in prod mode
  	entry: './frontend/main.js',
  	output: {
  		path: config.publicDir,
  		filename: '[name].bundle.js',
  		publicPath: '/',
  	},
  	optimization: {
  		splitChunks: {
  			cacheGroups: {
  				commons: {
  					test: /[\\/]node_modules[\\/]/,
  					name: 'vendors',
  					chunks: 'all',
  				},
  			},
  		},
  		runtimeChunk: 'single',
  	},
  	resolve: {
  		extensions: [
  			'.js',
  			'.vue',
  		],
  	},
  	target: 'web',
  	module: {
  		rules: [
  			{
  				test: /\.bundle\.js$/,
  				loader: 'bundle-loader',
  				options: {
  					lazy: true,
  				},
  			},
  			{
  				test: /\.vue$/,
  				loader: 'vue-loader',
  			},
  			{
  				test: /\.css$/,
  				use: [
  					'vue-style-loader',
  					{
  						loader: 'css-loader',
  						options: {
  							esModule: false,
  						},
  					},
  				],
  			},
  			{
  				test: /\.scss$/,
  				use: [
  					'vue-style-loader',
  					{
  						loader: 'css-loader',
  						options: {
  							esModule: false,
  						},
  					},
  					{
  						loader: 'sass-loader',
  						options: {
  							implementation: dartSass,
  						},
  					},
  				],
  			},
  			{
  				test: /\.js$/,
  				use: {
  					loader: 'babel-loader',
  				},
  				exclude: /node_modules/,
  			},
  			{
  				test: /\.(png|svg|jpg|gif)$/,
  				use: [
  					{
  						loader: 'file-loader',
  						options: {
  							name: '[name].[contenthash].[ext]',
  						},
  					},
  				],
  			},
  		],
  	},
  	plugins: [
  		new VueLoaderPlugin(),
  		new HtmlWebpackPlugin({
  			template: './public/template.html',
  			title: 'Site title',
  			filename: 'index.html',
  		}),
  		new CompressionPlugin({
  			filename: '[path].br[query]',
  			algorithm: 'brotliCompress',
  			test: /\.(js|css|html|svg)$/,
  			compressionOptions: {
  				level: 11,
  			},
  			threshold: 10240,
  			minRatio: 0.8,
  		}),
  	],
  };
  