Package file uploader Plugin for Webpack Azure Blob Storage
- Supports Account Key or SAS Token.
- Supports modifying the base URL.
pnpm add @metalist/webpack-plugin-blob-storage -D
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
Name | Type | Default | Required | Description |
---|---|---|---|---|
accountName |
{String} |
true | The name of the Azure Storage account. | |
accountKey |
{String} |
false | The account key for the Azure Storage account. | |
sasToken |
{String} |
false | The SAS token for the Azure Storage account. | |
containerName |
{String} |
true | The name of the container. | |
subPath |
{String} |
false | The subPath of the container. | |
excludes |
{Array[string]} |
['.DS_Store', '*.map'] | false | excluded 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 themap
file extension.
-
-
accountKey
andsasToken
- The priority of
accountKey
is higher thansasToken
. -
accountKey
and sasToken cannot be empty at the same time
- The priority of
-
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.
Released under the MIT License.