LoginSignup
3
0

More than 3 years have passed since last update.

nuxt(spa)でrollbarにsource mapをuploadする

Posted at
upload_sourcemap.sh
#!/bin/sh

# Save a short git hash, must be run from a git
# repository (or a child directory)
version=$(git rev-parse --short HEAD)

# Use the post_server_time access token, you can
# find one in your project access token settings
post_server_item=$ROLLBAR_CLIENT_KEY

echo "Uploading source maps for version $version!"

# We upload a source map for each resulting JavaScript
# file; the path depends on your build config
for path in $(find dist/_nuxt -name "*.js"); do
  # URL of the JavaScript file on the web server
  js_file=$(basename $path)
  url=https://$1/_nuxt/$js_file

  # a path to a corresponding source map file
  source_map="@$path.map"

  echo "Uploading source map for $url"

  curl --silent --show-error https://api.rollbar.com/api/1/sourcemap \
    -F access_token=$post_server_item \
    -F version=$version \
    -F minified_url=$url \
    -F source_map=$source_map \
    > /dev/null
done

ciでbuildした後に以下を実行

./upload_sourcemap.sh example.com(運用しているドメイン)

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0