html-webpack-cdn-path-plugin
Works with Webpack 2.
Installation
npm i html-webpack-cdn-path-plugin --save-dev
Use
webpack.config.js:
const CdnPathWebpackPlugin = ;moduleexports =entry:app: './main.js'output:filename: '[name].js'path: '.dist/'publicPath: '/'plugins:runtimeCdnPath: '//cdn1.static.com''//cdn2.static.com'assetsJsCdnPath: '//cdn1.static.com''//cdn2.static.com'assetsCssCdnPath: '//cdn1.static.com''//cdn2.static.com'
Result
1. manifest (use runtimeCdnPath)
/******/ // __webpack_public_path__/******/ __webpack_require__p = "/"; /******/ // publicPath override (html-webpack-cdn-path-plugin)/******/ __webpack_require__p = "//cdn1.static.com""//cdn2.static.com"Math+'/' || __webpack_require__p; // cdn + publicPath
2. assets js,css
jsUrl = randomAssetsJsCdnPathStr + outputpublicPath + outputfilenamecssUrl = randomAssetsCssCdnPathStr + outputpublicPath + outputfilename
License
The MIT License.