const path = require('path');

module.exports = {
  mode: 'production',
  entry: path.resolve(__dirname, 'src/renderer.ts'),
  target: 'electron-renderer',
  output: {
    path: path.resolve(__dirname, 'frontend'),
    filename: 'bundle.js',
  },
  module: {
    rules: [
      {
        test: /\.svelte$/,
        loader: [
          {
            loader: 'svelte-loader',
          },
        ],
      },
      {
        test: /\.ts$/,
        loader: [
          {
            loader: 'ts-loader',
            options: {
              configFile: path.resolve('tsconfig.renderer.json'),
            },
          },
        ],
      },
      {
        test: /\.mjs$/,
        include: /node_modules/,
        type: 'javascript/auto',
      },
    ],
  },
  resolve: {
    extensions: ['.ts', '.js', '.mjs'],
  },
};
