浏览器页面刷新会破坏我的应用程序。
我在世博会的通用应用程序中使用了react导航。当用户在路由"/“上刷新浏览器时,一切都按预期工作。当用户在任何其他路由(例如"/search“)上刷新时,我看到它提供了如下服务:
无法获得/search
我看过很深的链接
import * as Linking from 'expo-linking'
...
const prefix = Linking.createURL('/')
const linking={
prefixes: [prefix],
config: {
screens: PathsByName,
},
}
<NavigationContainer linking={linking}>
...
</NavigationContainer>还有一种风俗webpack
config.devServer.historyApiFallback = {
index: 'index.html'
}但我仍然不能得到简单的页面刷新,以正确加载。
发布于 2021-11-14 16:17:06
问题是我对webpack配置进行了错误的定制。
这个配置有效,
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv)
// avoid improper settings here
return config
}https://stackoverflow.com/questions/69961070
复制相似问题