webpack-plugin-cdn-free

1.0.19 • Public • Published

webpack-plugin-cdn-free

Traversal encapsulation of the webpack output file

Install

$ npm i webpack-plugin-cdn-free --save-dev

Conifg

const webpack = require('webpack'); //to access built-in plugins
var CdnWebpack = require('webpack-plugin-cdn-free')
 
module.exports = {
  module: {
    rules: [
      { test: /\.txt$/, use: 'raw-loader' }
    ]
  },
  plugins: [
    new CdnWebpack({
      callback:function(fileName,localPath){
        // custom cdn ...
        return true // Returning false interrupts
      },
      publicPath: "http://example.com", // cdn domain names
      prefixPath: "prefixPath", // The url common prefix that needs to be passed to the CDN
    })
    ...
  ]
};

ignore

If need to use the CDN file exclusion. You need to create a new file ".cdnignore"

./.cdnignore

index.html
dist/statis/*

Exclude the rules:here

Introduction

  • This plug-in supports only one CDN domain
  • There may be problems with prefix configuration and domain name configuration failure, please be sure to use problems. issue
  • The existing policy of this plug-in will interrupt the whole process in case of failure for any reason to ensure the quality of release.
  • If you encounter packaged output that is not completely generated from the configured extension, you need to check yourself to see if it is really missing.

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i webpack-plugin-cdn-free

Weekly Downloads

1

Version

1.0.19

License

MIT

Unpacked Size

5.09 kB

Total Files

4

Last publish

Collaborators

  • micahchiu