0.0.4 • Published 4 years ago

@zbyfe/sourcemap_upload_aliyunoss_webpack_plugin v0.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

sourcemap_upload_aliyunoss_webpack_plugin

webpack(>=2)插件,上传 js 和 js.map 文件到阿里云 oss

Installation

Using npm:

$ npm install @zbyfe/sourcemap_upload_aliyunoss_webpack_plugin --save-dev

Using yarn:

$ yarn add @zbyfe/sourcemap_upload_aliyunoss_webpack_plugin --save-dev

Usage

  1. webpack usage
const SourceMapPlugin = require('@zbyfe/sourcemap_upload_aliyunoss_webpack_plugin');

const config = {
  plugins: [
    devtool:'source-map'
    new SourceMapPlugin({
      host: 'https://xxx.com',
      region: 'xxx-xxx-xxx',
      accessKeyId: 'xxxxxxx',
      accessKeySecret: 'xxxxxx',
      bucket: 'xxxxxx',
      version: '1.0.2',
      project: 'xxx',

      env: 'test',
      timeout: 30000,
      test: false,
      include: ['.js', '.js.map'],
      ignore: ['node_modules'],
      deleteSourceMap: true,
      buildDirectory: 'dist'
    }),
  ],
};
  1. vue usage
const SourcemapPlugin = require("@zbyfe/sourcemap_upload_aliyunoss_webpack_plugin");

module.exports = {
  productionSourceMap: true,
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === "production") {
      config.plugins.push(
        (host: "https://xxx.com"),
        (region: "xxx-xxx-xxx"),
        (accessKeyId: "xxxxxxx"),
        (accessKeySecret: "xxxxxx"),
        (bucket: "xxxxxx"),
        (version: "1.0.2"),
        (project: "xxx"),
        (env: "test"),
        (timeout: 30000),
        (test: false),
        (include: [".js", ".js.map"]),
        (ignore: ["node_modules"]),
        (deleteSourceMap: true),
        (buildDirectory: "dist")
      );
    }
  },
};
  1. Params
OptionTypeRequiredDescription
hoststringrequiredcdn 域名
diststringrequired上传到 oss 哪个目录下,默认为 oss 根目录。可作为路径前缀使用
regionstringrequired阿里云上传区域
accessKeyIdstringrequired阿里云的授权 accessKeyId
accessKeySecretstringrequired阿里云的授权 accessKeySecret
bucketstringrequired上传到哪个 bucket
versionstringrequired当前项目版本
projectstringrequired当前项目名称
envstringoptional当前环境,要包含 onlineprodpretestdev字符串,默认值为production
timeoutnumberoptionaloss 超时设置,默认为 30 秒(30000)
testbooleanoptional测试,仅显示要上传的文件,但是不执行上传操作。默认 false
includearray/stringoptional上传文件类型,默认值'.js', '.js.map'
ignorearray/stringoptional忽略上传的文件夹,默认值'node_modules'
deleteSourceMapBooleanoptional上传完成后是否删除 sourcemap 文件,默认值 true
buildDirectoryStringoptional打包指定生成的目录,e.g. builddist
0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.13

4 years ago