const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const webpack = require('webpack');
const glob = require('glob');

module.exports = {
    // mode: "production",
    mode: "development",
    entry: './src/js/app.js',
    devtool: "inline-source-map",
    devServer: {
        contentBase: './dist'
    },
    plugins: [
        new CleanWebpackPlugin(['dist']),
        new HtmlWebpackPlugin({
            title:'Output Management'
        }),
        new webpack.NamedModulesPlugin()
    ],
    output: {
        filename: "bundle.js",
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [
            {
                test:/\.html$/,
                use:[
                    {
                        loader:'file-loader',
                        // options:{
                        //     name:'[path][name].[ext]',
                        // }
                    }
                ],
                exclude: path.resolve(__dirname, 'src/index.html')
            }
        ]
    }
};