Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 89 lines 3.1 kB view raw
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') 5const {sentryWebpackPlugin} = require('@sentry/webpack-plugin') 6const {version} = require('./package.json') 7 8const GENERATE_STATS = process.env.EXPO_PUBLIC_GENERATE_STATS === '1' 9const OPEN_ANALYZER = process.env.EXPO_PUBLIC_OPEN_ANALYZER === '1' 10 11const reactNativeWebWebviewConfiguration = { 12 test: /postMock.html$/, 13 use: { 14 loader: 'file-loader', 15 options: { 16 name: '[name].[ext]', 17 }, 18 }, 19} 20 21module.exports = async function (env, argv) { 22 env.babel = { 23 dangerouslyAddModulePathsToTranspile: ['@bsky.app/expo'], 24 } 25 let config = await createExpoWebpackConfigAsync(env, argv) 26 config = withAlias(config, { 27 'react-native$': 'react-native-web', 28 'react-native-webview': 'react-native-web-webview', 29 // Force ESM version 30 'unicode-segmenter/grapheme': require 31 .resolve('unicode-segmenter/grapheme') 32 .replace(/\.cjs$/, '.js'), 33 'react-native-gesture-handler': false, // RNGH should not be used on web, so let's cause a build error if it sneaks in 34 '@sentry-internal/replay': false, // not used, ~300kb of dead weight 35 }) 36 config.module.rules = [ 37 ...(config.module.rules || []), 38 reactNativeWebWebviewConfiguration, 39 ] 40 if (env.mode === 'development') { 41 config.plugins.push(new ReactRefreshWebpackPlugin()) 42 config.devServer = config.devServer || {} 43 config.devServer.historyApiFallback = { 44 ...(config.devServer.historyApiFallback || {}), 45 // Handles like `xan.lol` contain dots, which the default history 46 // fallback treats as asset requests instead of app routes. 47 disableDotRule: true, 48 } 49 // Reap zombie HMR WebSocket connections that linger after refresh. 50 // Without this, dead sockets exhaust the browser's per-origin connection 51 // pool and the dev server stops responding. 52 config.devServer.onListening = devServer => { 53 devServer.server.on('connection', socket => { 54 socket.setTimeout(10000) 55 socket.on('timeout', () => socket.destroy()) 56 }) 57 } 58 } else { 59 // Support static CDN for chunks 60 config.output.publicPath = 'auto' 61 } 62 63 if (GENERATE_STATS || OPEN_ANALYZER) { 64 config.plugins.push( 65 new BundleAnalyzerPlugin({ 66 openAnalyzer: OPEN_ANALYZER, 67 generateStatsFile: true, 68 statsFilename: '../stats.json', 69 analyzerMode: OPEN_ANALYZER ? 'server' : 'json', 70 defaultSizes: 'parsed', 71 }), 72 ) 73 } 74 if (process.env.SENTRY_AUTH_TOKEN) { 75 config.plugins.push( 76 sentryWebpackPlugin({ 77 org: 'blueskyweb', 78 project: 'app', 79 authToken: process.env.SENTRY_AUTH_TOKEN, 80 release: { 81 // fallback needed for Render.com deployments 82 name: process.env.SENTRY_RELEASE || version, 83 dist: process.env.SENTRY_DIST, 84 }, 85 }), 86 ) 87 } 88 return config 89}