"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const webpackConfig = {
    entry: '__ADDED_AT_RUNTIME__',
    output: {
        filename: 'bundle.js',
        path: '__ADDED_AT_RUNTIME__',
        libraryTarget: 'umd', // Universal Module Definition
        globalObject: 'apptileSDK', // Necessary for UMD to work in Node and browser environments
    },
    stats: {
        colors: false
    },
    mode: 'development',
    externals: {
        'react': {
            commonjs: 'react',
            commonjs2: 'react',
            amd: 'react',
            root: 'React', // Global variable in non-module environments
        },
        'react-native': {
            commonjs: 'react-native',
            commonjs2: 'react-native',
            amd: 'react-native',
            root: 'ReactNative', // Global variable in non-module environments
        },
        'apptile-core': {
            commonjs: 'apptile-core',
            commonjs2: 'apptile-core',
            amd: 'apptile-core',
            root: 'ApptileCore', // Global variable in non-module environments
        },
        'react-native-svg': {
            commonjs: 'react-native-svg',
            commonjs2: 'react-native-svg',
            amd: 'react-native-svg',
            root: 'ReactNativeSvg', // Global variable in non-module environments
        },
        '@react-navigation/native': {
            commonjs: '@react-navigation/native',
            commonjs2: '@react-navigation/native',
            amd: '@react-navigation/native',
            root: 'ReactNavNative', // Global variable in non-module environments
        },
        '@react-navigation/bottom-tabs': {
            commonjs: '@react-navigation/bottom-tabs',
            commonjs2: '@react-navigation/bottom-tabs',
            amd: '@react-navigation/bottom-tabs',
            root: 'ReactNavBottomTabs', // Global variable in non-module environments
        },
        'lottie-react-native': {
            commonjs: 'lottie-react-native',
            commonjs2: 'lottie-react-native',
            amd: 'lottie-react-native',
            root: 'Lottie', // Global variable in non-module environments
        },
        'react-redux': {
            commonjs: 'react-redux',
            commonjs2: 'react-redux',
            amd: 'react-redux',
            root: 'ReactRedux',
        }
    },
    module: {
        rules: [
            {
                test: /\.jsx$/,
                exclude: modulePath => (/node_modules/.test(modulePath) && !/node_modules\/sdk-plugin-example/.test(modulePath)),
                use: {
                    loader: 'babel-loader',
                    options: {
                        cacheDirectory: true,
                        // The 'metro-react-native-babel-preset' preset is recommended to match React Native's packager
                        presets: ['module:@react-native/babel-preset'],
                        // Re-write paths to import only the modules needed by the app
                        // plugins: ['react-native-web']
                    },
                },
            },
        ],
    },
    resolve: {
        extensions: ['.js', '.jsx'],
        modules: ['__ADDED_AT_RUNTIME__']
    },
};
exports.default = webpackConfig;
