Skip to content

Commit

Permalink
fix: handling @import with spaces and any extensions (#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Mar 10, 2021
1 parent 3f49ed0 commit 0c47cf7
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/index.js
Expand Up @@ -66,7 +66,6 @@ export default async function loader(content, map, meta) {
extensions: [".css"],
mainFields: ["css", "style", "main", "..."],
mainFiles: ["index", "..."],
restrictions: [/\.css$/i],
});

plugins.push(
Expand Down
4 changes: 3 additions & 1 deletion src/utils.js
Expand Up @@ -79,7 +79,9 @@ function defaultGetLocalIdent(
}

function normalizeUrl(url, isStringValue) {
let normalizedUrl = url;
let normalizedUrl = url
.replace(/^( |\t\n|\r\n|\r|\f)*/g, "")
.replace(/( |\t\n|\r\n|\r|\f)*$/g, "");

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

0 comments on commit 0c47cf7

Please sign in to comment.