# cdn-webpack-plugin

> publish your static assets in the different cdns

Latest version **1.0.3** (published 2016-09-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install cdn-webpack-plugin
pnpm add cdn-webpack-plugin
yarn add cdn-webpack-plugin
bun add cdn-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-09-06 |
| First published | 2016-09-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | vic.wang |
| Maintainers | vic.wang163 |
| Keywords | cdn, webpack, plugin |

## Links

- npm: https://www.npmjs.com/package/cdn-webpack-plugin
- Repository: https://github.com/vicwang163/cdn-webpack-plugin
- Homepage: https://github.com/vicwang163/cdn-webpack-plugin#readme
- Issues: https://github.com/vicwang163/cdn-webpack-plugin/issues
- npm.io page: https://npm.io/package/cdn-webpack-plugin

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2016-09-06
- 1.0.2 — 2016-09-06
- 1.0.1 — 2016-09-06
- 1.0.0 — 2016-09-06

## README

CDN Webpack Plugin
===================

Installation
------------
Install the plugin with npm:
```shell
$ 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:

```javascript
var cdnWebpackPlugin = require('cdn-webpack-plugin');
var webpackConfig = {
  entry: {
    'main':['main.js']
    'home':['home.js']
    'index':['index.js']
  },
  output: {
    path: 'dist',
    filename: '[name].js',
    publicPath:'/static'
  },
  plugins: [new cdnWebpackPlugin(['http://cdn1.cdn.com','http://cdn2.cdn.com'])]
};
```

This will generate a file `dist/index.html` containing the following:
```html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Webpack App</title>
  </head>
  <body>
    <script src="http://cdn1.cdn.com/static/main.js"></script>
    <script src="http://cdn2.cdn.com/static/home.js"></script>
    <script src="http://cdn1.cdn.com/static/index.js"></script>
  </body>
</html>
```

---
_Source: https://npm.io/package/cdn-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
