const Dotenv = require('dotenv-webpack');
const path = require('path');

module.exports = {
  target: 'electron-renderer',
  entry: {
    main: './src/main.tsx'
  },

  output: {
    path: path.join(__dirname, '../src'),
    filename: '[name].js'
  },

  module: {
    rules: [{
      test: /\.tsx?$/,
      use: 'awesome-typescript-loader',
      exclude: /node_modules/
    }, {
      test: /\.scss$/,
      use: ['style-loader', 'css-loader', 'sass-loader'],
      exclude: /node_modules/
    }, {
      test: /\.(woff2?|ttf|eot|svg|otf).*$/,
      use: 'file-loader?name=fonts/[name].[ext]'
    }]
  },

  plugins: [
    new Dotenv({
      path: path.resolve(__dirname, '../.env'),
      safe: true
    })
  ],

  resolve: {
    extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.css']
  }

};
