Vue CLI S3 Deployment Plugin

4.0.0-rc3 · active · verified Sun Apr 19

Vue CLI Plugin S3 Deploy is a utility designed to streamline the deployment of built Vue.js applications to AWS S3 buckets. It offers comprehensive features including support for custom AWS regions, management of AWS credential profiles and environment variables, configuration for S3 static site hosting, and concurrent uploads to enhance deployment speed. Additionally, it integrates with CloudFront for cache invalidation, applies correct `Cache-Control` metadata for Progressive Web Apps (PWAs) and Service Workers, handles GZIP compression, and allows for configurable deployment paths, enabling multiple Vue applications within a single S3 bucket. The package is currently in its 4.x release candidate series, with `4.0.0-rc3` being the latest specified release candidate, indicating active development towards a stable version. Given it's a CLI plugin, its release cadence is tied to Vue CLI updates and community contributions. A key differentiator is its deep integration with the Vue CLI ecosystem, providing a guided setup and `vue.config.js` based configuration.

Common errors

Warnings

Install

Quickstart

Shows how to install, configure in `vue.config.js`, and deploy a Vue.js app to S3.

# Install the plugin
npm install -D vue-cli-plugin-s3-deploy
# OR
yarn add -D vue-cli-plugin-s3-deploy

# Invoke the plugin to set up initial configuration and package.json script
vue invoke s3-deploy

// vue.config.js
module.exports = {
  pluginOptions: {
    s3Deploy: {
      awsProfile: process.env.VUE_APP_S3D_AWS_PROFILE ?? 'default', // Use 'default' profile or env var
      region: process.env.VUE_APP_S3D_REGION ?? 'us-east-1',
      bucket: process.env.VUE_APP_S3D_BUCKET ?? 'your-s3-bucket-name',
      createBucket: false,
      staticHosting: true,
      staticIndexPage: 'index.html',
      staticErrorPage: 'index.html', // Essential for Vue Router history mode
      assetPath: 'dist',
      deployPath: '/',
      pwa: true,
      enableCloudfront: true,
      cloudfrontId: process.env.VUE_APP_S3D_CLOUDFRONT_ID ?? '',
      cloudfrontPaths: ['/*', '/index.html']
    }
  }
};

# Build and deploy your app (requires AWS credentials configured)
npm run deploy
# OR
yarn deploy

view raw JSON →