Skip to content

Commit b02c8ac

Browse files
test: more (#1163)
1 parent 143693e commit b02c8ac

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed

src/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ function pitch(request) {
361361
}
362362

363363
this.importModule(
364-
`${this._module.matchResource || this.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
364+
`${this._module && this._module.matchResource ? this._module.matchResource : this.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
365365
{
366366
layer: options.layer,
367367
publicPath: /** @type {string} */ (publicPathForExtract),

test/cases/match-resource-url/expected/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ body {
22
background-image: url(static/icon.svg);
33
}
44

5+
body {
6+
background-image: url(./icon.svg);
7+
}
8+
9+
body {
10+
background-image: url(./icon.svg);
11+
}
12+
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
import "./virtual.css!=!./source.txt";
2+
import "./virtual.css?=query!=!./source.txt";
3+
import "./other.css?=query";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background-image: url(./icon.svg);
3+
}

test/cases/match-resource-url/webpack.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ module.exports = {
66
rules: [
77
{
88
test: /\.css$/,
9+
resourceQuery: { not: /query/ },
910
use: [Self.loader, "css-loader"],
1011
},
12+
{
13+
test: /\.css$/,
14+
resourceQuery: /query/,
15+
use: [
16+
Self.loader,
17+
{
18+
loader: "css-loader",
19+
options: {
20+
url: false,
21+
},
22+
},
23+
],
24+
},
1125
{
1226
test: /\.svg$/,
1327
issuer: /\.css$/,

0 commit comments

Comments
 (0)