html-webpack-chunk-prefix-plugin

0.0.2 • Public • Published

introduction

给 html chunk 添加前缀

Useage

// webpack.config.js
const HtmlWebpackChunkPrefixPlugin = require('html-webpack-chunk-prefix-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
 
const staticUrl = 'http://static.alicdn.com/';
 
module.exports = {
  
  plugins: {
    new HtmlWebpackPlugin({
      template: './index.html',
      chunks: 'all',
      inject: 'body'
    }),
    new HtmlWebpackChunkPrefixPlugin({
      prefix: staticUrl
    }),
  }
}

output

 
<!DOCTYPE html>
<html lang>
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=0.7,user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <link href="//static.alicdn.com/index.81c09bd12692705dc859.css" rel="stylesheet">
 
    <title>app</title>
</head>
 
 
<body>
<div id="root"></div>
<script type="text/javascript" src="//static.alicdn.com/common.25871385850e3baf2d03.js"></script>
<script type="text/javascript" src="//static.alicdn.com/index.81c09bd12692705dc859.js"></script></body>
</html>
 

Readme

Keywords

none

Package Sidebar

Install

npm i html-webpack-chunk-prefix-plugin

Weekly Downloads

2

Version

0.0.2

License

ISC

Unpacked Size

2.33 kB

Total Files

3

Last publish

Collaborators

  • sunyongjian