diff --git a/lib/hexo/index.ts b/lib/hexo/index.ts index b9ca764dd4..86926900a1 100644 --- a/lib/hexo/index.ts +++ b/lib/hexo/index.ts @@ -41,8 +41,6 @@ import type { AssetGenerator, LocalsType, NodeJSLikeCallback, NormalPageGenerato import type { AddSchemaTypeOptions } from 'warehouse/dist/types'; import type Schema from 'warehouse/dist/schema'; -let resolveSync; // = require('resolve'); - const libDir = dirname(__dirname); const dbVersion = 1; @@ -457,16 +455,9 @@ class Hexo extends EventEmitter { // Try to resolve the plugin with the Node.js's built-in require.resolve. return require.resolve(name, { paths: [basedir] }); } catch (err) { - try { - // There was an error (likely the node_modules is corrupt or from early version of npm) - // Use Hexo prior 6.0.0's behavior (resolve.sync) to resolve the plugin. - resolveSync = resolveSync || require('resolve').sync; - return resolveSync(name, { basedir }); - } catch (err) { - // There was an error (likely the plugin wasn't found), so return a possibly - // non-existing path that a later part of the resolution process will check. - return join(basedir, 'node_modules', name); - } + // There was an error (likely the node_modules is corrupt or from early version of npm), + // so return a possibly non-existing path that a later part of the resolution process will check. + return join(basedir, 'node_modules', name); } } diff --git a/package.json b/package.json index 3a4407991a..965447ed7d 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "nunjucks": "^3.2.3", "picocolors": "^1.0.0", "pretty-hrtime": "^1.0.3", - "resolve": "^1.22.0", "strip-ansi": "^6.0.0", "text-table": "^0.2.0", "tildify": "^2.0.0",