如何处理AWS Amplify上的Expo链接



我正试图将我的Expo链接配置发布到我的AWS Amplify项目。我的配置工作在本地主机,但不工作,当我发布它。我做错了什么?

我有以下导航代码:

export default function Navigation() {
return (
<NavigationContainer
linking={LinkingConfiguration}
fallback={HomeContainer}
theme={DefaultTheme}>
<RootNavigator />
</NavigationContainer>
);
}

连接配置:

import * as Linking from 'expo-linking';
import { Screens } from '../types/types'
export default {
prefixes: [Linking.makeUrl('/')],
config: {
screens: {
Root: {
screens: /* screens routes */
}
}
}
}

以及以下Amplify的构建配置:

version: 1.0
frontend:
phases:
preBuild:
commands:
- nvm use 12
- npm install --quiet --global expo-cli
- >
if [ -f yarn.lock ]; then
yarn
elif [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
npm ci
else
npm install
fi
build:
commands:
- ENV=production expo build:web
artifacts:
baseDirectory: web-build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- $(npm root --global)/**/*

解决灵感来自这个问题:Nuxtjs动态路由在AWS Amplify控制台作为SPA部署后不能在页面加载时工作

刚刚添加了这个重定向:源地址:</^[^.]+$|.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>

目标地址:/index.html

类型:200 (Rewrite)

最新更新