Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config = withAlias(config);
const projectRoot = options.projectRoot || process.cwd();
const env: any = {
platform: 'electron',
projectRoot,
mode: config.mode === 'production' ? config.mode : 'development',
locations: getPaths(projectRoot),
};
if (!config.plugins) config.plugins = [];
if (!config.resolve) config.resolve = {};
env.config = getConfig(env);
const [plugin] = getPluginsByName(config, 'HtmlWebpackPlugin');
if (plugin) {
const { options } = plugin.plugin as any;
// Replace HTML Webpack Plugin so we can interpolate it
// @ts-ignore: webpack version mismatch
config.plugins.splice(plugin.index, 1, new HtmlWebpackPlugin(options));
config.plugins.splice(
plugin.index + 1,
0,
// Add variables to the `index.html`
// @ts-ignore
ExpoInterpolateHtmlPlugin.fromEnv(env, HtmlWebpackPlugin)
);
}
// Add support for expo-constants
// @ts-ignore: webpack version mismatch