aws-amplify - 在 './aws-exports' 中找不到文件 './src'

标签 aws-amplify

我在这个 AWS tutorial to build a React app with AWS, Amplify and GraphQL 的第三个模块上但构建不断打破。当我运行 amplify push --y CLI 生成 ./src/aws-exports.js并将相同的文件添加到 .gitignore .所以我对构建失败并不感到惊讶,因为当我推送我的更改时该文件不包括在内。
所以我不确定在这里做什么。考虑到它会自动添加到 .gitignore我很犹豫要不要删除它。
有什么建议么?

最佳答案

我假设您正在尝试在 CI/CD 环境中构建您的应用程序?
如果是这种情况,那么您需要先构建放大应用程序的后端部分,然后才能构建前端组件。
例如,我的应用程序是从 AWS 放大控制台构建的,在我的build设置中我有

version: 0.1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - yarn install --frozen-lockfile
    build:
      commands:
        - yarn build
  artifacts:
    baseDirectory: build
    files:
      - "**/*"
  cache:
    paths:
      - node_modules/**/*
请注意,后端首先使用 amplifyPush --simple 构建。命令。这就是生成 aws-exports.js 的原因。文件。

关于aws-amplify - 在 './aws-exports' 中找不到文件 './src',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62706549/

相关文章:

java - 从 lambda 表达式中更新 AtomicBoolean

azure - 如何将 amplify 中的 azure 存储库集成到 CI/CD 中?

reactjs - 如何等待 aws cognito authenticateUser 调用(这似乎是一个回调)

javascript - 如何将 Cognito 托管的 UI 集成到 React 应用程序中?

amazon-web-services - AWS 无法为 amplify 应用程序创建后端

android - AWS Cognito 规则无法匹配使用 aws amplify (Android) 的插入式身份验证 UI

aws-amplify - 对于 Amplify Datastore 设置,有没有办法关闭 AWS AppSync 以仅在本地工作?

expo - AWS Amplify `configure` 没有选项

image - 使用 AWS Amplify 从 React Native 上传到 S3

amazon-web-services - 通过链接进行 Cognito 无密码身份验证