const path = require("path")

const { CleanWebpackPlugin } = require("clean-webpack-plugin")
const { VueLoaderPlugin } = require('vue-loader');

module.exports = {
    mode: "production",
    resolve:{
        alias: {
            'vue': 'vue/dist/vue.js'
        }
    },
    entry: {
        main: './src/main.ts',
        // login: './src/login.ts'
    },
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: "[name].js"
    },
    module: {
        rules: [
        {
            test: /\.ts$/,
            include: [path.resolve(__dirname, "./src")],
            use: [
                {
                    loader: "babel-loader",
                    options: {
                        presets: [
                            "@babel/preset-env"
                        ]
                    }    
                },
                {
                    loader: "ts-loader"
                }
            ]            
        },            
        {
            test: /\.vue$/,
            exclude: /node_modules/,
            use: "vue-loader"
        },
        {
            test: /\.less$/,
            use: [
                "style-loader",
                "css-loader",
                "less-loader"
            ]
        }        
        ]
    },
    plugins: [
        new VueLoaderPlugin()
    ]
};
