1.1.0 • Published 1 year ago

@metalist/webpack-plugin-blob-storage v1.1.0

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

Webpack Plugin Blob Storage

Package file uploader Plugin for Webpack Azure Blob Storage

Features

  • Supports Account Key or SAS Token.
  • Supports modifying the base URL.

Install

pnpm add @metalist/webpack-plugin-blob-storage -D

Usage

import { BlobStorageWebpackPlugin } from "@metalist/webpack-plugin-blob-storage";

const useCDN = process.env.USE_CDN === 'true'

const config = {
  publicPath: useCDN ? process.env.BLOB_CDN_PATH + '/' : '/',
  plugins: [
    new BlobStorageWebpackPlugin(useCDN, {
        accountName: process.env.BLOB_ACCOUNT_NAME!,
        sasToken: process.env.BLOB_SAS_TOKEN,
        containerName: process.env.BLOB_CONTAINER_NAME!,
        subPath: process.env.BLOB_SUB_PATH,
        excludes: ['*.html'],
      }
    ),
  ]
}

Options

NameTypeDefaultRequiredDescription
accountName{String}trueThe name of the Azure Storage account.
accountKey{String}falseThe account key for the Azure Storage account.
sasToken{String}falseThe SAS token for the Azure Storage account.
containerName{String}trueThe name of the container.
subPath{String}falseThe subPath of the container.
excludes{Array[string]}'.DS_Store', '*.map'falseexcluded content 型
  • containerName

    • The length of a container name can be from 3 to 63 characters.
    • The container name must start with a letter or number and can only contain lowercase letters, numbers, and hyphens (-).
    • Consecutive hyphens are not allowed in the container name.
  • excludes Matching related files or folders. For detailed usage, please refer to: micromatch

    • *.map do not upload files with the map file extension.
  • accountKey and sasToken

    • The priority of accountKey is higher than sasToken.
    • accountKey and sasToken cannot be empty at the same time
  • subPath

    • The subPath suggestion use the project name.
    • The subPath can be used to distinguish different projects in the same container.
    • The subPath container name must start with a letter or number and can only contain lowercase letters, numbers, and hyphens (-).
    • The length of a container name can be from 3 to 63 characters.

License

Released under the MIT License.

1.1.0

1 year ago

1.0.0

1 year ago