Skip to content

Commit 143693e

Browse files
authored
fix: use matchResource for importModule when available (#1162)
1 parent da57ee5 commit 143693e

File tree

7 files changed

+39
-1
lines changed

7 files changed

+39
-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.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
364+
`${this._module.matchResource || this.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
365365
{
366366
layer: options.layer,
367367
publicPath: /** @type {string} */ (publicPathForExtract),
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
background-image: url(static/icon.svg);
3+
}
4+
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "./virtual.css!=!./source.txt";
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+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import yn from "../../helpers/yn";
2+
3+
module.exports = () => !yn(process.env.OLD_API);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Self from "../../../src";
2+
3+
module.exports = {
4+
entry: "./index.js",
5+
module: {
6+
rules: [
7+
{
8+
test: /\.css$/,
9+
use: [Self.loader, "css-loader"],
10+
},
11+
{
12+
test: /\.svg$/,
13+
issuer: /\.css$/,
14+
type: "asset/resource",
15+
generator: {
16+
filename: "static/[name][ext]",
17+
},
18+
},
19+
],
20+
},
21+
plugins: [
22+
new Self({
23+
filename: "[name].css",
24+
}),
25+
],
26+
};

0 commit comments

Comments
 (0)