vite-plugin-aws3

0.3.0 • Public • Published

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

Option Type Default Description
uploadEnabled Boolean true This setting can be used to disable or enable the uploading of assets
exclude String A Regex Pattern to match for excluded content
include String A Regex Pattern to match for included content. Behaves the same as exclude

Example Usage

$ UPLOAD_ENABLED=true yarn prod

Package Sidebar

Install

npm i vite-plugin-aws3

Weekly Downloads

6

Version

0.3.0

License

MIT

Unpacked Size

9.8 kB

Total Files

5

Last publish

Collaborators

  • treeletnet