From 8ebd760a5b0b445fbcec7af414eaa59457cf17e0 Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Fri, 25 Feb 2022 12:22:00 +0300 Subject: [PATCH] up enhanced-resolve version --- lib/ContextModule.js | 7 ++++--- package.json | 2 +- types.d.ts | 2 +- yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 100eda5188b..3b0bcced413 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -374,8 +374,9 @@ class ContextModule extends Module { // build if enforced if (this._forceBuild) return callback(null, true); - // always build when we have no snapshot - if (!this.buildInfo.snapshot) return callback(null, true); + // always build when we have no snapshot and context + if (!this.buildInfo.snapshot) + return callback(null, Boolean(this.context || this.options.resource)); fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { callback(err, !valid); @@ -490,7 +491,7 @@ class ContextModule extends Module { ); return; } - if (!this.context || !this.options.resource) return callback(); + if (!this.context && !this.options.resource) return callback(); compilation.fileSystemInfo.createSnapshot( startTime, diff --git a/package.json b/package.json index 55619e4453a..487695fd35b 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "acorn-import-assertions": "^1.7.6", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.9.0", + "enhanced-resolve": "^5.9.1", "es-module-lexer": "^0.9.0", "eslint-scope": "5.1.1", "events": "^3.2.0", diff --git a/types.d.ts b/types.d.ts index 264827032e1..f11b0f5ea13 100644 --- a/types.d.ts +++ b/types.d.ts @@ -2526,7 +2526,7 @@ declare interface ContextModuleOptions { * exports referenced from modules (won't be mangled) */ referencedExports?: string[][]; - resource: string | string[]; + resource: string | false | string[]; resourceQuery?: string; resourceFragment?: string; resolveOptions: any; diff --git a/yarn.lock b/yarn.lock index 1657eea582a..f22f9bcafaa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2259,10 +2259,10 @@ enhanced-resolve@^4.0.0: memory-fs "^0.5.0" tapable "^1.0.0" -enhanced-resolve@^5.9.0: - version "5.9.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz#49ac24953ac8452ed8fed2ef1340fc8e043667ee" - integrity sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA== +enhanced-resolve@^5.9.1: + version "5.9.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.1.tgz#e898cea44d9199fd92137496cff5691b910fb43e" + integrity sha512-jdyZMwCQ5Oj4c5+BTnkxPgDZO/BJzh/ADDmKebayyzNwjVX1AFCeGkOfxNx0mHi2+8BKC5VxUYiw3TIvoT7vhw== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0"