const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
{% if mode == 'separate' %}
const HtmlWebpackPlugin = require('html-webpack-plugin')
{% endif %}

module.exports = {
  entry: {
    main: path.resolve(__dirname, '../fn/main.js'),
  },
  output: {
    path: path.resolve(__dirname, '../dist'),
    filename: '[name].js',
  },
  module: {
    rules: [
{% if has_vue %}
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
            css: ExtractTextPlugin.extract({
              use: 'css-loader',
              fallback: 'vue-style-loader'
            })
          }
        }
      },
{% endif %}
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
        }
      },
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          use: "css-loader",
          fallback: "style-loader",
        })
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin({
      filename: '[name].css', disable: false, allChunks: true
    }),
{% if mode == 'separate' %}
    new HtmlWebpackPlugin(),
{% endif %}
  ],
}