2023-03-13 22:01:43 +01:00
|
|
|
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
|
|
|
|
const {withAlias} = require('@expo/webpack-config/addons')
|
2023-09-05 20:13:42 +02:00
|
|
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
|
2023-03-13 22:01:43 +01:00
|
|
|
|
|
|
|
const reactNativeWebWebviewConfiguration = {
|
|
|
|
test: /postMock.html$/,
|
|
|
|
use: {
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = async function (env, argv) {
|
|
|
|
let config = await createExpoWebpackConfigAsync(env, argv)
|
|
|
|
config = withAlias(config, {
|
|
|
|
'react-native$': 'react-native-web',
|
|
|
|
'react-native-linear-gradient': 'react-native-web-linear-gradient',
|
|
|
|
'react-native-webview': 'react-native-web-webview',
|
|
|
|
})
|
|
|
|
config.module.rules = [
|
|
|
|
...(config.module.rules || []),
|
|
|
|
reactNativeWebWebviewConfiguration,
|
|
|
|
]
|
2023-09-05 20:13:42 +02:00
|
|
|
if (env.mode === 'development') {
|
|
|
|
config.plugins.push(new ReactRefreshWebpackPlugin())
|
|
|
|
}
|
2023-03-13 22:01:43 +01:00
|
|
|
return config
|
|
|
|
}
|