"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const webpack_merge_1 = __importDefault(require("webpack-merge"));
const path_1 = __importDefault(require("path"));
/**
 * Patch React Native imports
 * @param config
 * @param builder
 */
const CustomApp = () => (config, builder) => {
    const CUSTOM_APP_JS = builder.appJsPath;
    if (fs_1.default.existsSync(`${CUSTOM_APP_JS}.js`) ||
        fs_1.default.existsSync(`${CUSTOM_APP_JS}.jsx`) ||
        fs_1.default.existsSync(`${CUSTOM_APP_JS}.ts`) ||
        fs_1.default.existsSync(`${CUSTOM_APP_JS}.tsx`)) {
        return webpack_merge_1.default(config, {
            resolve: {
                alias: {
                    CUSTOM_APP_JS
                },
            },
        });
    }
    else {
        return webpack_merge_1.default(config, {
            resolve: {
                alias: {
                    CUSTOM_APP_JS: path_1.default.join(__dirname, '../../client/App')
                },
            },
        });
    }
};
exports.default = CustomApp;
//# sourceMappingURL=CustomApp.js.map