Skip to content

Commit

Permalink
up enhanced-resolve version
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Feb 26, 2022
1 parent 0a7446b commit e819c06
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
7 changes: 4 additions & 3 deletions lib/ContextModule.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
Expand Up @@ -5,7 +5,7 @@ module.exports = {
resolve: {
modules: [path.resolve(__dirname, "a"), path.resolve(__dirname, "b")],
alias: {
[path.resolve(__dirname, "a/foo")]: false
[path.resolve(__dirname, "a", "foo")]: false
}
}
};
8 changes: 4 additions & 4 deletions test/configCases/resolve/empty-context-module/index.js
@@ -1,7 +1,7 @@
const id = () => Math.random();

it("should compile", () => {
expect(/* webpackMode: "lazy" */ import(`foo/${id()}`)).rejects.toBeTruthy();
expect(/* webpackMode: "lazy" */ import(`foo/${id()}`)).rejects.toBeTruthy();
expect(/* webpackMode: "lazy" */ import(`foo/${id()}`)).rejects.toBeTruthy();
it("should compile", async () => {
await expect(/* webpackMode: "lazy" */ import(`foo/${id()}`)).rejects.toBeTruthy();
await expect(/* webpackMode: "lazy" */ import(`foo/${id()}`)).rejects.toBeTruthy();
await expect(/* webpackMode: "lazy" */ import(`foo/${id()}`)).rejects.toBeTruthy();
});
2 changes: 1 addition & 1 deletion types.d.ts
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -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"
Expand Down

0 comments on commit e819c06

Please sign in to comment.