From 557baf43a32f126a5f11665767f85fe121cc185a Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 9 Feb 2024 12:24:46 +0500 Subject: [PATCH] mobile: fix release build --- apps/mobile/native/webpack.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/mobile/native/webpack.config.js b/apps/mobile/native/webpack.config.js index 49bd744fe..e523acfb6 100644 --- a/apps/mobile/native/webpack.config.js +++ b/apps/mobile/native/webpack.config.js @@ -2,6 +2,9 @@ const path = require("path"); const TerserPlugin = require("terser-webpack-plugin"); const Repack = require("@callstack/repack"); +const { webpack, NormalModuleReplacementPlugin } = require("webpack"); + + /** * More documentation, installation, usage, motivation and differences with Metro is available at: @@ -102,6 +105,9 @@ module.exports = (env) => { "katex": path.join(__dirname, "../node_modules/katex"), "tinycolor2": path.join(__dirname, "../node_modules/tinycolor2"), }, + fallback: { + "crypto": false, + } }, /** * Configures output. @@ -307,6 +313,12 @@ module.exports = (env) => { ], }, plugins: [ + new NormalModuleReplacementPlugin( + /node:crypto/, + (resource) => { + resource.request = resource.request.replace(/^node:/, ''); + } + ), /** * Configure other required and additional plugins to make the bundle * work in React Native and provide good development experience with