CDN Webpack Plugin
Installation
Install the plugin with npm:
$ npm install cdn-webpack-plugin --save-dev
Basic Usage
as we know,in the webpack config,publicPath
is only a string,but in my daily project.
we will meet one situation,we should put the static resources into different domain of CDN
this is what we want to fix
config as follows:
var cdnWebpackPlugin = ;var webpackConfig = entry: 'main':'main.js' 'home':'home.js' 'index':'index.js' output: path: 'dist' filename: '[name].js' publicPath:'/static' plugins: 'http://cdn1.cdn.com''http://cdn2.cdn.com';
This will generate a file dist/index.html
containing the following:
Webpack App