Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
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 let config = await createExpoWebpackConfigAsync(env, argv)
23 config = withAlias(config, {
24 'react-native$': 'react-native-web',
25 'react-native-webview': 'react-native-web-webview',
26 // Force ESM version
27 'unicode-segmenter/grapheme': require
28 .resolve('unicode-segmenter/grapheme')
29 .replace(/\.cjs$/, '.js'),
30 'react-native-gesture-handler': false, // RNGH should not be used on web, so let's cause a build error if it sneaks in
31 })
32 config.module.rules = [
33 ...(config.module.rules || []),
34 reactNativeWebWebviewConfiguration,
35 ]
36 if (env.mode === 'development') {
37 config.plugins.push(new ReactRefreshWebpackPlugin())
38 } else {
39 // Support static CDN for chunks
40 config.output.publicPath = 'auto'
41 }
42
43 if (GENERATE_STATS || OPEN_ANALYZER) {
44 config.plugins.push(
45 new BundleAnalyzerPlugin({
46 openAnalyzer: OPEN_ANALYZER,
47 generateStatsFile: true,
48 statsFilename: '../stats.json',
49 analyzerMode: OPEN_ANALYZER ? 'server' : 'json',
50 defaultSizes: 'parsed',
51 }),
52 )
53 }
54 if (process.env.SENTRY_AUTH_TOKEN) {
55 config.plugins.push(
56 sentryWebpackPlugin({
57 org: 'blueskyweb',
58 project: 'app',
59 authToken: process.env.SENTRY_AUTH_TOKEN,
60 release: {
61 // fallback needed for Render.com deployments
62 name: process.env.SENTRY_RELEASE || version,
63 dist: process.env.SENTRY_DIST,
64 },
65 }),
66 )
67 }
68 return config
69}