diff --git a/scripts/events/lib/vendors.js b/scripts/events/lib/vendors.js index af47027e8..e64badddd 100644 --- a/scripts/events/lib/vendors.js +++ b/scripts/events/lib/vendors.js @@ -19,6 +19,12 @@ module.exports = hexo => { if (typeof internal === 'function') { internal(hexo, dependencies); } + let { plugins = 'cdnjs' } = vendors; + if (plugins === 'local' && typeof internal === 'undefined') { + hexo.log.warn('Dependencies for `plugins: local` not found. The default CDN provider CDNJS is used instead.'); + hexo.log.warn('Run `npm install @next-theme/plugins` in Hexo site root directory to install the plugin.'); + plugins = 'cdnjs'; + } for (const [key, value] of Object.entries(dependencies)) { // This script will be executed repeatedly when Hexo listens file changes // But the variable vendors[key] only needs to be modified once @@ -41,12 +47,6 @@ module.exports = hexo => { local : url_for.call(hexo, `lib/${name}/${file}`), custom : vendors.custom_cdn_url }); - let { plugins = 'cdnjs' } = vendors; - if (plugins === 'local' && typeof internal === 'undefined') { - hexo.log.warn('Dependencies for `plugins: local` not found. The default CDN provider CDNJS is used instead.'); - hexo.log.warn('Run `npm install @next-theme/plugins` in Hexo site root directory to install the plugin.'); - plugins = 'cdnjs'; - } vendors[key] = { url : links[plugins] || links.cdnjs, integrity: value.integrity