Rollup S3 Plugin

raw JSON →
1.0.2 verified Mon Apr 27 auth: no javascript abandoned

A Rollup plugin that uploads compiled bundle assets to AWS S3 after each build. Version 1.0.2 (last updated 2020) is the latest stable release; the project has not seen updates since and is considered unmaintained. It mirrors the configuration of webpack-s3-plugin, using the same options such as `s3Options`, `s3UploadOptions`, and `directory`. There are no TypeScript definitions and limited error handling. Unlike alternatives like `rollup-plugin-aws`, this plugin batches uploads but lacks modern features (e.g., multi-region, S3 transfer acceleration).

error TypeError: s3Plugin is not a function
cause Using CommonJS require with default ES module export.
fix
Use dynamic import: const s3Plugin = (await import('rollup-s3-plugin')).default; or switch to ESM config.
error Error: Cannot find module 'rollup-s3-plugin'
cause Package not installed or missing peer dependency rollup.
fix
Run npm install -D rollup-s3-plugin rollup.
error AccessDenied: Access Denied
cause AWS credentials do not have sufficient permissions to upload to the specified S3 bucket.
fix
Ensure IAM user/role has s3:PutObject and s3:PutObjectAcl permissions on the bucket. Check environment variables for keys.
error Error: Missing region in s3Options
cause s3Options object does not include a region property.
fix
Add region: 'us-east-1' (or your bucket's region) to the s3Options config.
deprecated Package is abandoned; no updates since 2020. May not work with Rollup v2+ or Node 18+.
fix Consider alternatives like rollup-plugin-s3 or custom upload script using @aws-sdk/client-s3.
breaking Default export was removed in v1.0.0; you must use named export or default import from correct path.
fix Use `import s3Plugin from 'rollup-s3-plugin'` (default) or `import { s3Plugin } from 'rollup-s3-plugin'` (named).
gotcha Plugin uploads all files in the output directory; does not respect Rollup's asset file list. May upload sourcemaps unintentionally.
fix Set `directory` to a subfolder or filter files manually using `s3UploadOptions.Key`.
gotcha Does not support S3 Transfer Acceleration or custom endpoints out of the box.
fix Configure via `s3Options.endpoint` if using minio or other S3-compatible services.
npm install rollup-s3-plugin
yarn add rollup-s3-plugin
pnpm add rollup-s3-plugin

Configures Rollup to upload all files from 'dist' directory to an S3 bucket after each build. Uses environment variables for AWS credentials.

import s3Plugin from 'rollup-s3-plugin';

const accessKeyId = process.env.AWS_ACCESS_KEY_ID ?? '';
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY ?? '';

export default {
  input: 'src/index.js',
  output: {
    dir: 'dist',
    format: 'esm'
  },
  plugins: [
    s3Plugin({
      s3Options: {
        accessKeyId,
        secretAccessKey,
        region: 'us-east-1'
      },
      s3UploadOptions: {
        Bucket: 'my-bucket',
        ACL: 'public-read'
      },
      directory: 'dist'
    })
  ]
};