const webpackConfig = require("./webpack.config");

module.exports = (env) => {
    // Here you can modify env before passing them to the default config
    const config = webpackConfig(env);

    // Here you can modify everything created by the default configuration

    const terserWebpackPlugin = config.optimization.minimizer[0];
    const terserOptions = terserWebpackPlugin.options.terserOptions;
    terserOptions['mangle'] = false;
    terserOptions['keep_fnames'] = true;

    return {
        ...config,
        externals: {
            ...config.externals,
            'nativescript-sqlite-commercial': 'nativescript-sqlite-commercial',
            'nativescript-sqlite-encrypted': 'nativescript-sqlite-encrypted',
            'nativescript-sqlite-sync': 'nativescript-sqlite-sync',
        },
    };
};
