0.1.1 • Published 5 years ago

split-source-webpack-plugin v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

split-source-webpack-plugin

简体中文

This is a webpack plugin which is also based on html-webpack-plugin. It is used to split lib code from your project. The difference between this plugin and dll is that dll will bundle the lib code to one js file (This file will also be very big sometime), and this plugin can split lib code to different script tag. This plugin can save project users' time on production environment.

Install

npm install split-source-webpack-plugin --save-dev

Usage

var HTMLWebpackPlugin = require('html-webpack-plugin')
var SplitSourceWebpackPlugin = require('split-source-webpack-plugin')

module.exports = {
  ...
  plugins: [
    new HTMLWebpackPlugin(),
    new SplitSourceWebpackPlugin([
      {
        libName: 'xx',
        globalName: 'yy',
        url: 'http://www.host.com/lib/name/${version}'
      }
    ])
  ]
}

Options

NameTypeDefaultDescription
libName{String}''The name of library which is used in project. For example, if Vue is required in project: var Vue = require('vue'), then libName should be set as vue
globalName{String}''The name of library under global environment. For example, if Vue is required in project: var Vue = require('vue'), then globalName should be set as Vue
url{String}''The source address of library. It can be local address or CDN address. Also, you can use ${version} to tell the plugin to extract version info in package.json automatically
0.1.1

5 years ago

0.1.0

6 years ago