0.3.0 • Published 1 year ago

vite-plugin-aws3 v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

This plugin will upload all built assets to s3.

This package was heavily inspired by vite-plugin-s3

Install Instructions

$ npm i vite-plugin-aws3

$ yarn add vite-plugin-aws3
Import vite-plugin-aws3 in your vite config file and add it as a vite plugin.
import viteAws from 'vite-plugin-aws3';

export default defineConfig({
    plugins: [
        viteAws({
            s3: {
                profile: 'my_aws_profile',
                region: 'us-east-1',
                bucket: 'my-website-bucket',
            },
            cloudFront: {
                distributionId: 'E3IXXXXXXXXXX',
                paths: ['/*'],
            },
        }),
    ]
});
Config Example
viteAws({
    exclude: /.*\.img/,
    include: /.*\.js$/,
    uploadEnabled: !!process.env.UPLOAD_ENABLED,
    s3: {
        profile: 'my_aws_profile',
        region: 'us-east-1',
        bucket: 'my-website-bucket',
    },
    cloudFront: {
        distributionId: 'E3IXXXXXXXXXX',
        paths: ['/*'],
    },
})

Options

OptionTypeDefaultDescription
uploadEnabledBooleantrueThis setting can be used to disable or enable the uploading of assets
excludeStringA Regex Pattern to match for excluded content
includeStringA Regex Pattern to match for included content. Behaves the same as exclude

Example Usage

$ UPLOAD_ENABLED=true yarn prod