diff --git a/crates/rspack_plugin_css/src/parser_and_generator/mod.rs b/crates/rspack_plugin_css/src/parser_and_generator/mod.rs index cdca4895fcb..00cbcd3be06 100644 --- a/crates/rspack_plugin_css/src/parser_and_generator/mod.rs +++ b/crates/rspack_plugin_css/src/parser_and_generator/mod.rs @@ -164,7 +164,7 @@ impl ParserAndGenerator for CssParserAndGenerator { range, kind, } => { - if request.is_empty() { + if request.trim().is_empty() { continue; } let request = replace_module_request_prefix( diff --git a/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/__snapshots__/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/__snapshots__/output.snap.txt new file mode 100644 index 00000000000..c58d966b87a --- /dev/null +++ b/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/__snapshots__/output.snap.txt @@ -0,0 +1,7 @@ +```css title=main.css +body { + background: red url(' '); +} + + +``` \ No newline at end of file diff --git a/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/index.js b/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/index.js new file mode 100644 index 00000000000..4fe51c72d64 --- /dev/null +++ b/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/index.js @@ -0,0 +1 @@ +import "./style.css"; diff --git a/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/style.css b/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/style.css new file mode 100644 index 00000000000..328d5ecda4e --- /dev/null +++ b/packages/rspack-test-tools/tests/builtinCases/plugin-css/simple-url/style.css @@ -0,0 +1,3 @@ +body { + background: red url(' '); +}