fix web not building

This commit is contained in:
Oleksii Bulenok
2026-07-30 18:54:35 +02:00
parent 103c23517e
commit 8a5fc05700
+15
View File
@@ -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 = [