const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
    mode: 'development',
    entry: './index.ts',
    output: {
        path: path.resolve(__dirname, '..', '..', 'client_packages'),
        filename: 'index.js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: { loader: 'babel-loader' }
            },
            {
                test: /\.ts$/,
                use: {
                    loader: 'ts-loader',
                    options: {
                        allowTsInNodeModules: true
                    }
                }
            }
        ]
    },
    plugins: [
        new CopyPlugin([
            { from: 'dlcpacks/', to: '../source_dlcpacks/', force: true },
            { from: 'assets/**/*', to: '../client_packages/' }
        ])
    ],
    resolve: {
        extensions: ['.ts', '.js', '.json']
    }
};