vite-plugin-aws3
v0.3.0
Published
This plugin will deploy assets to AWS (S3 & Cloudfront)
Maintainers
Readme
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-aws3Import 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