Skip to content

Spaces around unquoted CSS url() values are not consistent #781

Closed
@webpack-bot

Description

@webpack-bot

Bug report

What is the current behavior?

Un-quoted CSS url() values are not consistent in their handling of trailing spaces. For example,

background-image: url(Truchet_tiling_inverse.png);

works where

background-image: url(Truchet_tiling_inverse.png );

does not (note the trailing space character). The latter results in:

This relative module was not found:
* ./Truchet_tiling_inverse.png in ./node_modules/css-loader??ref--1-2!./test.css

If the URL value is quoted, the problem does not occur. I assume it's expecting the filename to also have a space character at the end (i.e. .png ).

The problem does also not occur if there's a leading space, i.e. this is fine:

background-image: url( Truchet_tiling_inverse.png);

If the current behavior is a bug, please provide the steps to reproduce.

I have made a minimal example. To replicate:

git clone https://github.com/samwilson/webpack-issue
cd webpack-issue
npm install
./node_modules/.bin/encore production

What is the expected behavior?

The URL with a space after it should work equivalently to one without a space, as it does in web browsers etc.

Other relevant information:
webpack version: 3.8.14
Node.js version: v8.10.0
Operating System: Linux
Additional tools: Encore 0.20.1


This issue was moved from webpack/webpack#8155 by @evilebottnawi. Original issue was by @samwilson.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions