my fork of the bluesky client
1const createExpoWebpackConfigAsync = require('@expo/webpack-config')
2const {withAlias} = require('@expo/webpack-config/addons')
3const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
4const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')
5
6const GENERATE_STATS = process.env.EXPO_PUBLIC_GENERATE_STATS === '1'
7const OPEN_ANALYZER = process.env.EXPO_PUBLIC_OPEN_ANALYZER === '1'
8
9const reactNativeWebWebviewConfiguration = {
10 test: /postMock.html$/,
11 use: {
12 loader: 'file-loader',
13 options: {
14 name: '[name].[ext]',
15 },
16 },
17}
18
19module.exports = async function (env, argv) {
20 let config = await createExpoWebpackConfigAsync(env, argv)
21 config = withAlias(config, {
22 'react-native$': 'react-native-web',
23 'react-native-webview': 'react-native-web-webview',
24 })
25 config.module.rules = [
26 ...(config.module.rules || []),
27 reactNativeWebWebviewConfiguration,
28 ]
29 if (env.mode === 'development') {
30 config.plugins.push(new ReactRefreshWebpackPlugin())
31 }
32
33 if (GENERATE_STATS || OPEN_ANALYZER) {
34 config.plugins.push(
35 new BundleAnalyzerPlugin({
36 openAnalyzer: OPEN_ANALYZER,
37 generateStatsFile: true,
38 statsFilename: '../stats.json',
39 analyzerMode: OPEN_ANALYZER ? 'server' : 'json',
40 defaultSizes: 'parsed',
41 }),
42 )
43 }
44 return config
45}