0.3.0 • Published 1 year ago
vite-plugin-aws3 v0.3.0
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
0.3.0
1 year ago