Skip to content

Commit

Permalink
fix: ignore css include absolute files
Browse files Browse the repository at this point in the history
  • Loading branch information
noyobo committed Sep 27, 2023
1 parent dc9dd2c commit fc97fe0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions __tests__/css/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ exports[`css style-loader 2`] = `
}
.title {
color: #000;
background-image: url(/static/img/logo.png);
font-size: 20px;
}
@font-face {
Expand Down
2 changes: 2 additions & 0 deletions __tests__/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.title {
font-size: 20px;
color: #000;
/* ignore root files*/
background-image: url("/static/img/logo.png");
}


Expand Down
1 change: 1 addition & 0 deletions __tests__/less/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ exports[`less style-loader 2`] = `
-webkit-backdrop-filter: blur(2px);
backdrop-filter: blur(2px);
color: bisque;
background-image: url(/static/img/logo.png);
}
/*# sourceMappingURL=index.css.map */
"
Expand Down
1 change: 1 addition & 0 deletions __tests__/less/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

.index {
color: bisque;
background-image: url("/static/img/logo.png");
}
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ export const styleLoader = (options: StyleLoaderOptions = {}): Plugin => {
resolveDir: PATH.dirname(args.path),
};
});

build.onResolve({ filter: /^\//, namespace: 'css-loader' }, async (args) => {
return { external: true };
});
},
};
};

0 comments on commit fc97fe0

Please sign in to comment.