const webpack = require('webpack')
// 引入基本配置
const baseConfig = require('./webpack.base')
// 引入 webpack 配置合并插件
const { merge } = require('webpack-merge')
// 引入 path 模块
const path = require('path')
// 解析.vue文件
// const VueLoaderPlugin = require('vue-loader/lib/plugin')
const { VueLoaderPlugin } = require('vue-loader')
// 热更新插件
const HtmlWebpackPlugin = require('html-webpack-plugin')

const config = {
    mode: 'development',
    entry: path.resolve(__dirname, '../test/index.js'),
    devServer: {
        hot: true,
        open: true,
        client: {
            overlay: {
                warnings: false,
                errors: true
            }
        },
    },
    plugins: [
        new VueLoaderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new HtmlWebpackPlugin({
            template: 'test/index.html',
            filename: 'index.html'
        })
    ]
}

module.exports = merge(config, baseConfig)
