forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
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 })
27 config.module.rules = [
28 ...(config.module.rules || []),
29 reactNativeWebWebviewConfiguration,
30 ]
31 if (env.mode === 'development') {
32 config.plugins.push(new ReactRefreshWebpackPlugin())
33 } else {
34 // Support static CDN for chunks
35 config.output.publicPath = 'auto'
36 }
37
38 if (GENERATE_STATS || OPEN_ANALYZER) {
39 config.plugins.push(
40 new BundleAnalyzerPlugin({
41 openAnalyzer: OPEN_ANALYZER,
42 generateStatsFile: true,
43 statsFilename: '../stats.json',
44 analyzerMode: OPEN_ANALYZER ? 'server' : 'json',
45 defaultSizes: 'parsed',
46 }),
47 )
48 }
49 if (process.env.SENTRY_AUTH_TOKEN) {
50 config.plugins.push(
51 sentryWebpackPlugin({
52 org: 'blueskyweb',
53 project: 'app',
54 authToken: process.env.SENTRY_AUTH_TOKEN,
55 release: {
56 // fallback needed for Render.com deployments
57 name: process.env.SENTRY_RELEASE || version,
58 dist: process.env.SENTRY_DIST,
59 },
60 }),
61 )
62 }
63 return config
64}