Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Mar 28, 2022
1 parent cf5fc90 commit 5605e53
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/dependencies/ContextElementDependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class ContextElementDependency extends ModuleDependency {
return this._context;
}

/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier() {
return `context${this._context || ""}|${super.getResourceIdentifier()}`;
}
Expand Down
19 changes: 19 additions & 0 deletions test/configCases/resolve/issue-15580/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const locales = import.meta.webpackContext('./locales', {
recursive: false,
regExp: /(en|hu)\.json$/i,
});
const vuetify = import.meta.webpackContext('vuetify/lib/locale', {
recursive: false,
regExp: /(en|hu)\.json$/i,
});

it('should resolve "./locales"', () => {
expect(locales("./en.json")).toEqual({});
expect(() => locales("./hu.json")).toThrow();
});

it('should resolve "vuetify"', () => {
expect(vuetify("./en.json")).toEqual({});
expect(vuetify("./hu.json")).toEqual({});
expect(() => vuetify("./ru.json")).toThrow();
});
1 change: 1 addition & 0 deletions test/configCases/resolve/issue-15580/locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test/configCases/resolve/issue-15580/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require("path");

/** @type {import("../../../../").Configuration} */
module.exports = {
resolve: {
modules: ["node_modules", path.resolve(__dirname, "./node_modules")]
}
};

0 comments on commit 5605e53

Please sign in to comment.