const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const { stringify } = require('querystring');
module.exports = {
context: path.resolve(__dirname, 'src'),
mode: 'development',
entry : {
main: './index.js'
},
output: {
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: ['.js', '.png', 'svg']
},
optimization: {
splitChunks: {
chunks: 'all'
}
},
devServer: {
port: 8000
},
plugins: [
new HtmlWebpackPlugin(), // Generates default index.html
new HtmlWebpackPlugin({
template: './index2.html'
}),
new CleanWebpackPlugin()
],
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader','css-loader']
},
{
test: /\.(ttf|woff|woff2|eot)$/,
use: ['file-loader']
},
{
test: /\.(png|jpeg|gif|svg)$/,
use: ['file-loader']
}
]
}
}