vite-plugin-s3-asset-upload
v1.0.3
Published
Plugin for Vite bundler to allow for uploading assets to any S3 bucket at build-time.
Downloads
112
Readme
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 eitherinclude
orexclude
.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.