Skip to content

Commit

Permalink
use real loader path
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Jan 30, 2022
1 parent 64f2bdb commit 312239a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/NormalModuleFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ const stringifyLoadersAndResource = (loaders, resource) => {
const identToLoaderRequest = resultString => {
const idx = resultString.indexOf("?");
if (idx >= 0) {
const loader = resultString.substr(0, idx);
const loader = resultString.substr(0, idx).replace(/\0(.)/g, "$1");
const options = resultString.substr(idx + 1);
return {
loader,
options
};
} else {
return {
loader: resultString,
loader: resultString.replace(/\0(.)/g, "$1"),
options: undefined
};
}
Expand Down
1 change: 1 addition & 0 deletions test/configCases/loaders/#-issue-14755-#/#.my
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[a-z]
6 changes: 6 additions & 0 deletions test/configCases/loaders/#-issue-14755-#/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import regexp from './#.my';

it("should load regexp correctly", () => {
expect(regexp.test("1")).toBe(false);
expect(regexp.test("a")).toBe(true);
});

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.

11 changes: 11 additions & 0 deletions test/configCases/loaders/#-issue-14755-#/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import("../../../../").Configuration} */
module.exports = {
module: {
rules: [
{
test: /\.my$/,
loader: "regexp-#-loader"
}
]
}
};

0 comments on commit 312239a

Please sign in to comment.