Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nonzzz/vite-plugin-cdn
replace module with CDN. work with vite.
https://github.com/nonzzz/vite-plugin-cdn
vite-plugin vite-plugin-cdn
Last synced: 5 days ago
JSON representation
replace module with CDN. work with vite.
- Host: GitHub
- URL: https://github.com/nonzzz/vite-plugin-cdn
- Owner: nonzzz
- License: mit
- Created: 2022-09-21T08:50:13.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-13T10:13:55.000Z (2 months ago)
- Last Synced: 2025-02-06T19:12:27.248Z (12 days ago)
- Topics: vite-plugin, vite-plugin-cdn
- Language: TypeScript
- Homepage:
- Size: 3.02 MB
- Stars: 76
- Watchers: 1
- Forks: 6
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-cdn2 - Replace module with CDN. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-cdn2 - Replace module with CDN. (Plugins / Framework-agnostic Plugins)
README
![]()
![]()
## Install
```bash
$ yarn add vite-plugin-cdn2 -D
# or
$ npm install vite-plugin-cdn2 -D
```
## Usage
```typescript
// vite.config.tsimport { defineConfig } from "vite";
import { cdn } from "vite-plugin-cdn2";
export default defineConfig({
plugins: [
// ... your plugin
cdn({ modules: ["vue"] }),
],
});
```## Options
| params | type | default | description |
| ---------- | --------------------------- | ------------------------------------------- | ---------------------------------------------------- |
| `include` | `FilterPattern` | `/\.(mjs\|js\|ts\|vue\|jsx\|tsx)(\?.*\|)$/` | Include all assets matching any of these conditions. |
| `exlcude` | `FilterPattern` ß | `-` | Exclude all assets matching any of these conditions. |
| `modules` | `Array ` | `[]` | Should convert module. |
| `logLevel` | `slient\|warn` | `warn` | Adjust console output verbosity. |
| `resolve` | `ResolveOptions` | `jsdelivr plugin` | URL parser injected into the page. |
| `apply` | `string` | `build` | Same as vite apply. |### Acknowledgements
Thanks to [JetBrains](https://www.jetbrains.com/) for allocating free open-source licences for IDEs such as WebStorm.
![]()
### Document
- [Background](./docs/Background.md)
- [How it works](./docs/How-it-works.md)
- [Q & A](./docs/Q&A.md)### LICENSE
[MIT](./LICENSE)
### Author
Kanno