const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
const StyleLintPlugin = require('stylelint-webpack-plugin')

module.exports = {
    devtool: "source-map",
    entry: {
        'admin': path.join(__dirname, 'src', 'admin.js'),
        'sideMenu': path.join(__dirname, 'src', 'SideMenu.js'),
    },
    output: {
        path: path.resolve(__dirname, './js'),
        publicPath: '/js',
        filename: '[name].js?v=[hash]',
        chunkFilename: 'chunks/[name]-[hash].js',
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['vue-style-loader', 'css-loader'],
            },
            {
                test: /\.scss$/,
                use: ['vue-style-loader', 'css-loader', 'sass-loader'],
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader',
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
            },
            {
                test: /\.(png|jpg|gif|svg)$/,
                loader: 'url-loader',
                options: {
                    name: '[name].[ext]?[hash]',
                    limit: 8192,
                },
            },
        ],
    },
    plugins: [
        new VueLoaderPlugin(),
        new StyleLintPlugin(),
    ],
    resolve: {
        extensions: ['*', '.js', '.vue'],
        symlinks: false,
    },
}
