0.0.1 • Published 6 years ago

autocdn-webpack-plugin v0.0.1

Weekly downloads
1
License
GPL-3.0
Repository
-
Last release
6 years ago

Usage

const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackTemplate = require('html-webpack-template')
const AutoCDNWebpackPlugin = require('@rabbitcc/autocdn-webpack-plugin')

module.exports = {
  //...webpack options...
  plugins: [
    new AutoCDNWebpackPlugin(),
    new HtmlWebpackPlugin({
      template: HtmlWebpackTemplate,
      inject: false
    })
  ]
}

Interface

type PackageName = string
type GlobalExportName = string

type CDN =
  | { url: string | Array<string>, name: GlobalExportName }
  | {
      css: string | Array<string>,
      js: string | Array<string>,
      name: GlobalExportName
    }

type Options = {
  cdn: {                             // preset cdn by yourself
    [name: PackageName]: CDN
  },
  exclude: string | Array<string>,   // exclude some package
  include: string | Array<string>,   // include some package
  report: boolean                    // report result on before inject plugin
}