{"id":16387471,"url":"https://github.com/mastilver/dynamic-cdn-webpack-plugin","last_synced_at":"2025-04-12T23:42:59.924Z","repository":{"id":48949023,"uuid":"87723188","full_name":"mastilver/dynamic-cdn-webpack-plugin","owner":"mastilver","description":"Get your dependencies from a cdn rather than bundling them in your app","archived":false,"fork":false,"pushed_at":"2023-06-13T03:31:33.000Z","size":170,"stargazers_count":346,"open_issues_count":19,"forks_count":37,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T23:42:55.903Z","etag":null,"topics":["cdn","dynamic","html","html-webpack-plugin","unpkg","webpack","webpack-manifest-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mastilver.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-09T16:39:28.000Z","updated_at":"2025-02-10T15:06:55.000Z","dependencies_parsed_at":"2024-10-20T09:59:17.867Z","dependency_job_id":"b4d3411a-e45f-47b9-a4e7-839a73094416","html_url":"https://github.com/mastilver/dynamic-cdn-webpack-plugin","commit_stats":{"total_commits":83,"total_committers":7,"mean_commits":"11.857142857142858","dds":0.1325301204819277,"last_synced_commit":"5910d4718388e013032bb9b16adce20390225035"},"previous_names":["mastilver/modules-cdn-webpack-plugin"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastilver%2Fdynamic-cdn-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastilver%2Fdynamic-cdn-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastilver%2Fdynamic-cdn-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastilver%2Fdynamic-cdn-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastilver","download_url":"https://codeload.github.com/mastilver/dynamic-cdn-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647256,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdn","dynamic","html","html-webpack-plugin","unpkg","webpack","webpack-manifest-plugin"],"created_at":"2024-10-11T04:26:38.129Z","updated_at":"2025-04-12T23:42:59.894Z","avatar_url":"https://github.com/mastilver.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamic-cdn-webpack-plugin\n\n[![npm](https://img.shields.io/npm/v/dynamic-cdn-webpack-plugin.svg)](https://www.npmjs.com/package/dynamic-cdn-webpack-plugin) [![Build Status](https://travis-ci.org/mastilver/dynamic-cdn-webpack-plugin.svg?branch=master)](https://travis-ci.org/mastilver/dynamic-cdn-webpack-plugin) [![codecov](https://codecov.io/gh/mastilver/dynamic-cdn-webpack-plugin/badge.svg?branch=master)](https://codecov.io/gh/mastilver/dynamic-cdn-webpack-plugin?branch=master) [![David](https://img.shields.io/david/mastilver/dynamic-cdn-webpack-plugin.svg)](https://david-dm.org/mastilver/dynamic-cdn-webpack-plugin) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n\n\u003e Dynamically get your dependencies from a cdn rather than bundling them in your app\n\n## Install\n\n```\n$ npm install --save-dev dynamic-cdn-webpack-plugin module-to-cdn\n```\n\n## Compatibility with webpack\n\nIf you are using `webpack --version \u003c= 3` then you should be installing with the following command.\n\n```\n$ npm install --save-dev dynamic-cdn-webpack-plugin@3.4.1 module-to-cdn\n```\n\n## Usage with HtmlWebpackPlugin\n\n`webpack.config.js`\u003cbr\u003e\n```js\nconst path = require('path');\n\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst DynamicCdnWebpackPlugin = require('dynamic-cdn-webpack-plugin');\n\nmodule.exports = {\n    entry: {\n        'app.js': './src/app.js'\n    },\n\n    output: {\n        path.resolve(__dirname, './build'),\n    },\n\n    plugins: [\n        new HtmlWebpackPlugin(),\n        new DynamicCdnWebpackPlugin()\n    ]\n}\n```\n\n`app.js`\u003cbr\u003e\n```js\nimport React from 'react';\nimport { BrowserRouter } from 'react-router-dom';\n\n// ... do react stuff\n```\n\n`webpack --mode=production` will generate:\n\n```js\n/* simplified webpack build */\n[function(module, __webpack_exports__, __webpack_require__) {\n    module.exports = React;\n}),\n(function(module, __webpack_exports__, __webpack_require__) {\n    module.exports = ReactRouterDOM;\n}),\n(function(module, __webpack_exports__, __webpack_require__) {\n    var react = __webpack_require__(0);\n    var reactRouterDOM = __webpack_require__(1);\n\n    /* ... */\n})]\n```\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003eWebpack App\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cscript type=\"text/javascript\" src=\"https://unpkg.com/react@15.5.3/dist/react.min.js\"\u003e\u003c/script\u003e\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/react-router-dom@4.1.1/umd/react-router-dom.min.js\"\u003e\u003c/script\u003e\u003cscript src=\"build/app.js\"\u003e\u003c/script\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Usage with ManifestPlugin\n\n`webpack.config.js`\u003cbr\u003e\n```js\nconst path = require('path');\n\nconst ManifestPlugin = require('webpack-manifest-plugin');\nconst DynamicCdnWebpackPlugin = require('dynamic-cdn-webpack-plugin');\n\nmodule.exports = {\n    entry: {\n        'app': './src/app.js'\n    },\n\n    output: {\n        path.resolve(__dirname, './build'),\n    },\n\n    plugins: [\n        new ManifestPlugin({\n            fileName: 'manifest.json'\n        }),\n        new DynamicCdnWebpackPlugin()\n    ]\n}\n```\n\n`app.js`\u003cbr\u003e\n```js\nimport React from 'react';\nimport { BrowserRouter } from 'react-router-dom';\n\n// ... do react stuff\n```\n\n`webpack --mode=production` will generate:\n\n```js\n/* simplified webpack build */\n[function(module, __webpack_exports__, __webpack_require__) {\n    module.exports = React;\n}),\n(function(module, __webpack_exports__, __webpack_require__) {\n    module.exports = ReactRouterDOM;\n}),\n(function(module, __webpack_exports__, __webpack_require__) {\n    var react = __webpack_require__(0);\n    var reactRouterDOM = __webpack_require__(1);\n\n    /* ... */\n})]\n```\n\n```json\n{\n    \"app.js\": \"app.js\",\n    \"react.js\": \"https://unpkg.com/react@15.5.3/dist/react.min.js\",\n    \"react-router-dom.js\": \"https://unpkg.com/react-router-dom@4.1.1/umd/react-router-dom.min.js\"\n}\n```\n\n\n## API\n\n### DynamicCdnWebpackPlugin(options)\n\n`webpack.config.js`\u003cbr\u003e\n```js\nconst DynamicCdnWebpackPlugin = require('dynamic-cdn-webpack-plugin');\n\nmodule.exports = {\n    mode: 'production',\n    plugins: [\n        new DynamicCdnWebpackPlugin(options)\n    ]\n}\n```\n\n#### options.disable\n\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nUseful when working offline, will fallback to webpack normal behaviour\n\n#### options.env\n\nType: `string`\u003cbr\u003e\nDefault: `mode`\u003cbr\u003e\nValues: `development`, `production`\n\nDetermine if it should load the development or the production version of modules\n\n#### options.only\n\nType: `Array\u003cstring\u003e`\nDefault: `null`\n\nList the only modules that should be served by the cdn\n\n#### options.exclude\n\nType: `Array\u003cstring\u003e`\nDefault: `[]`\n\nList the modules that will always be bundled (not be served by the cdn)\n\n#### options.verbose\n\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nLog whether the library is being served by the cdn or is bundled\n\n#### options.resolver\nType: `string`, `function`\u003cbr\u003e\nDefault: `'module-to-cdn'`\n\nAllow you to define a custom module resolver, it can either be a `function` or an npm module.\nThe resolver should return (or resolve as a Promise) either `null` or an `object` with the keys: `name`, `var`, `url`, `version`.\n\n\n## Related\n\n- [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin)\n- [module-to-cdn](https://github.com/mastilver/module-to-cdn)\n\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/mastilver\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/4112409?v=4?s=100\" width=\"100px;\" alt=\"Thomas Sileghem\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eThomas Sileghem\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/commits?author=mastilver\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/commits?author=mastilver\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/commits?author=mastilver\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/aulisius\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/6629172?v=4?s=100\" width=\"100px;\" alt=\"​Faizaan\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e​Faizaan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-aulisius\" title=\"Answering Questions\"\u003e💬\u003c/a\u003e \u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/commits?author=aulisius\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/commits?author=aulisius\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://twitter.com/mjackson\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/92839?v=4?s=100\" width=\"100px;\" alt=\"MICHAEL JACKSON\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMICHAEL JACKSON\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/unpkg/unpkg-demos\" title=\"Examples\"\u003e💡\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://blog.fedeoo.cn/\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/5313455?v=4?s=100\" width=\"100px;\" alt=\"fedeoo\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003efedeoo\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/pull/21\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://effortlessmotion.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/756520?v=4?s=100\" width=\"100px;\" alt=\"Kevin Malakoff\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKevin Malakoff\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/mastilver/dynamic-cdn-webpack-plugin/commits?author=kmalakoff\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!\n\n\n## License\n\nMIT © [Thomas Sileghem](http://mastilver.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastilver%2Fdynamic-cdn-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastilver%2Fdynamic-cdn-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastilver%2Fdynamic-cdn-webpack-plugin/lists"}