const path = require('path');


module.exports = [{
    context: path.resolve(__dirname, './'),
    devtool: 'eval-source-map',
    entry: {
        setup: { import: './src/test/setup.ts', filename: 'test/setup.js' },
        dbtest: { import: './src/test/dbtest.ts', filename: 'test/dbtest.js' },
        serviceworker: { import: './src/ServiceWorker.ts', filename: 'ServiceWorker.js' },
        index: { import: './src/index.ts', filename: 'index.js' },
    },
    mode: 'development',
    module: {
        rules: [{
            test: /\.tsx?$/,
            use: 'ts-loader',
            exclude: [

            ]
        }]
    },
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'build/'),
        library: {
            name: 'privdb',
            type: 'umd'
        },
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.jsx', '.js']
    },
},
{
    context: path.resolve(__dirname, './'),
    entry: {
        serviceworker: './src/ServiceWorker.ts'
    },
    output: {
        filename: 'ServiceWorker.js',
        path: path.resolve(__dirname, 'build/'),
        libraryTarget: 'self' // Important for service workers
    },
    module: {
        rules: [{
            test: /\.tsx?$/,
            use: 'ts-loader',
            exclude: /node_modules/
        }]
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.js']
    },
    mode: 'development',
    devtool: 'eval-source-map'
}
]