const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: path.join(__dirname, 'src/index.js'),

  module: {
    rules: [
      // load .Vue files
      {
        test: /\.vue$/,
        loader: 'vue-loader',
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
      },
      // this will apply to both plain `.scss` files
      // AND `<style lang="scss">` blocks in `.vue` files
      {
        test: /\.scss$/,
        use: ['vue-style-loader', 'css-loader', 'sass-loader'],
      },
    ],
  },
  plugins: [
    // make sure to include the plugin!
    new VueLoaderPlugin(),
    // process HTML
    new HtmlWebpackPlugin(),
  ],
  resolve: {
    alias: { vue: 'vue/dist/vue.esm.js' },
    extensions: ['*', '.js', '.vue', '.json'],
  },
  stats: {
    colors: true,
  },
  devtool: '#eval-source-map',
}
