# html-webpack-cdn

> 无需配置 webpack externals 自动向 html-webpack-plugins 模板注入 unpkg cdn

Latest version **1.0.6** (published 2021-08-12) · MIT license · 0 weekly downloads

## Install

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

## 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.6 |
| Published | 2021-08-12 |
| First published | 2021-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 0 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | zzlwte |
| Maintainers | zzlwte |
| Keywords | webpack, plugin, html, html-webpack-cdn, cdn, html-webpack-plugin, externals, script, include, assets, production |

## Links

- npm: https://www.npmjs.com/package/html-webpack-cdn
- Repository: https://github.com/zzlw/html-webpack-cdn
- Issues: https://github.com/zzlw/html-webpack-cdn
- npm.io page: https://npm.io/package/html-webpack-cdn

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2021-08-12
- 1.0.5 — 2021-08-12
- 1.0.4 — 2021-08-12
- 1.0.3 — 2021-08-12
- 1.0.2 — 2021-08-12
- 1.0.1 — 2021-08-12
- 1.0.0 — 2021-08-12

## README

[![npm][npm]][npm-url]
[![node][node]][node-url]
[![GitHub issues](https://img.shields.io/github/issues/zzlw/html-webpack-cdn.svg)](https://github.com/zzlw/html-webpack-cdn/issues)
[![GitHub forks](https://img.shields.io/github/forks/zzlw/html-webpack-cdn.svg)](https://github.com/zzlw/html-webpack-cdn/network)
[![GitHub stars](https://img.shields.io/github/stars/zzlw/html-webpack-cdn.svg)](https://github.com/zzlw/html-webpack-cdn/stargazers)
[![GitHub license](https://img.shields.io/github/license/zzlw/html-webpack-cdn.svg)](https://github.com/zzlw/html-webpack-cdn/blob/main/LICENSE)

<div align="center">
  <img width="200" height="200" src="https://worldvectorlogo.com/logos/html5.svg">
  <a href="https://github.com/webpack/webpack">
    <img width="200" height="200"
      src="https://webpack.js.org/assets/icon-square-big.svg">
  </a>
  <div>
    <img width="100" height="100" title="Webpack Plugin" src="http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg">
  </div>
  <h1>html-webpack-cdn</h1>
  <p>无需配置 webpack externals 自动向 html-webpack-plugins 模板注入 unpkg cdn</p>
</div>

<h2 align="center">Install</h2>

<h3>Webpack 5</h3>

```bash
  npm i --save-dev html-webpack-cdn
```

```bash
  yarn add --dev html-webpack-cdn
```

```js
// 无需配置 webpack externals
// modules 为空则不会生效
const WebpackHtmlCdnPlugin = require("html-webpack-cdn");

const cdnEnv = process.env.NODE_ENV === 'development' ? 'development' : 'production.min';

new HtmlWebpackCdnPlugin({
  modules: [
    { name: 'react', _var: 'React', path: `umd/react.${cdnEnv}.js` },
    { name: 'react-dom', _var: 'ReactDOM', path: `umd/react-dom.${cdnEnv}.js` },
  ],
})
```

```html
<!-- html 中效果 -->
<script src="https://unpkg.com/react@17.0.2/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js"></script>
```

[npm]: https://img.shields.io/npm/v/html-webpack-cdn.svg
[npm-url]: https://npmjs.com/package/html-webpack-cdn

[node]: https://img.shields.io/node/v/html-webpack-cdn.svg
[node-url]: https://nodejs.org

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