1.0.3 • Published 1 year ago

vite-plugin-s3-asset-upload v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

vite-plugin-s3-asset-upload

A Vite plugin to upload assets to any S3 bucket.

Example usage:

export default {
    plugins: [
        s3AssetUpload({
            assetRoot: `/assets`,
            selectionMode: 'include',
            includeEntries: ['img', 'translations', 'fonts'],
            s3Options: {
                endpoint: process.env.S3_ENDPOINT,
                accessKeyId: process.env.ACCESS_KEY_ID,
                secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
                region: process.env.S3_REGION,
                bucket: process.env.S3_BUCKET,
                basePath: `app-assets`,
                setMimeType: true
            }
        })
    ]
};

Configuration

  • assetRoot - The root directory of the assets to be uploaded.
  • selectionMode - The mode of selection of the assets. Can be either include or exclude.
  • includeEntries - The list of directories to include.
  • excludeEntries - The list of directories to exclude.
  • s3Options - The options for the S3 bucket.
    • endpoint - The endpoint of the S3 bucket.
    • accessKeyId - The access key id.
    • secretAccess - The secret access key.
    • region - The region of the S3 bucket.
    • bucket - The name of the bucket.
    • basePath - The base path of the assets in the bucket.
    • setMimeType - Whether to set the mime type of the assets.