const {resolve} = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: './src/index.js',
    output:{
        filename: 'built.js',
        path: resolve(__dirname,'build')
    },
    module:{
        rules:[
            {
                test: /\.css$/,
                use: ['style-loader','css-loader']
            },
            //打包其他资源 除了html js css less
            {
                exclude:/\.(css|js|html|less)$/,
                loader:'file-loader',
                options:{
                    esModule: false,
                    name: '[hash:10].[ext]'
                },
                type: 'javascript/auto'
            }
        ]
    },
    plugins:[
        new HtmlWebpackPlugin({
            template: './src/index.html'
        })
    ],
    mode: 'development'
    
}