From 8a5fc0570007f7ee101987233eca3f1cdb74b62b Mon Sep 17 00:00:00 2001 From: Oleksii Bulenok Date: Thu, 30 Jul 2026 18:54:35 +0200 Subject: [PATCH] fix web not building --- webpack.config.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index dace4e8fe5..b78b5558a0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ const path = require('path') const createExpoWebpackConfigAsync = require('@expo/webpack-config') +const webpack = require('webpack') const {withAlias} = require('@expo/webpack-config/addons') const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin') const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer') @@ -78,6 +79,20 @@ module.exports = async function (env, argv) { )]: false, }) + /* + * expo-font's serverContext.web.js imports `node:async_hooks` for SSR-only + * font collection, but webpack can't resolve `node:` URIs for web targets. + * Every call site is guarded by `typeof window === 'undefined'`, so in the + * browser bundle the module is dead code - strip the scheme prefix and stub + * the builtin out with an empty module. + */ + config.plugins.push( + new webpack.NormalModuleReplacementPlugin(/^node:async_hooks$/, resource => { + resource.request = 'async_hooks' + }), + ) + config.resolve.fallback = {...config.resolve.fallback, async_hooks: false} + // react-native-uuid ships sourceMappingURL comments but no .map files. patchSourceMapFilter(config.module.rules, /react-native-uuid/) config.module.rules = [