0

我有一个使用 web pack 的 Reactjs web 项目。当我进行产品构建时,会创建一个包含源映射的 dist 文件夹。然后每次我创建一个新标签时,我都会在 Sentry 中创建一个新版本。但是 circle 在 docker 镜像中找不到 dist 文件夹,这意味着 circle 构建失败。

  - run:
      name: Install sentry-cli
      command: curl -sL https://sentry.io/get-cli/ | bash

  - run:
      name: Create new sentry release from latest tag
      command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

  - run:
      name: Upload Source Maps to sentry
      command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist

我在将新标签推送到 docker 后运行此命令,但出现此错误。

error: ./dist: IO error for operation on ./dist: No such file or directory (os error 2)
Exited with code 1

我如何才能访问包含源映射的 dist 文件夹?

4

1 回答 1

2

我不确定您的项目是如何设置的 - 但通常该dist文件夹位于.gitignore而不上传到 GIT,因此在 CI 中不可用。

如果您在 CI 上构建应用程序,则该dist文件夹将变为可用。我假设您的构建命令是npm run build,但它也可能是yarn build您用于构建应用程序的任何自定义命令。

- run:
    name: Build react application
    command: npm run build

- run:
    name: Install sentry-cli
    command: curl -sL https://sentry.io/get-cli/ | bash

- run:
    name: Create new sentry release from latest tag
    command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

- run:
    name: Upload Source Maps to sentry
    command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist
于 2018-05-03T01:33:46.833 回答