const path = require('path');

module.exports = {
    entry: './js/main.tsx',
    output: {
        path: path.join(__dirname, './dist'),
        filename: 'bundle.min.js',
        pathinfo: false,
    },
    devServer: {
        port: 9001,
        disableHostCheck: true,
        historyApiFallback: {
            disableDotRule: true,
        },
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js', '.jsx'],
    },
    devtool: 'source-map',
    module: {
        rules: [
            {
                test: /\.js?|\.ts?|\.tsx?|.jsx?$/,
                exclude: /(node_modules)/,
                use: [
                    {
                        loader: 'babel-loader',
                    },
                    {
                        loader: 'ts-loader',
                        options: {
                            transpileOnly: true,
                            experimentalWatchApi: true,
                        },
                    },
                ],
            },
            {
                test: /\.js$/,
                use: ['source-map-loader'],
                enforce: 'pre',
            },
        ],
    },
};
