Skip to content

Commit 0c47cf7

Browse files
fix: handling @import with spaces and any extensions (#1272)
1 parent 3f49ed0 commit 0c47cf7

File tree

5 files changed

+109
-12
lines changed

5 files changed

+109
-12
lines changed

src/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export default async function loader(content, map, meta) {
6666
extensions: [".css"],
6767
mainFields: ["css", "style", "main", "..."],
6868
mainFiles: ["index", "..."],
69-
restrictions: [/\.css$/i],
7069
});
7170

7271
plugins.push(

src/utils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ function defaultGetLocalIdent(
7979
}
8080

8181
function normalizeUrl(url, isStringValue) {
82-
let normalizedUrl = url;
82+
let normalizedUrl = url
83+
.replace(/^( |\t\n|\r\n|\r|\f)*/g, "")
84+
.replace(/( |\t\n|\r\n|\r|\f)*$/g, "");
8385

8486
if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
8587
normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, "");

0 commit comments

Comments
 (0)