Css-loader: url with paths to directories bug

Created on 28 Aug 2016  路  6Comments  路  Source: webpack-contrib/css-loader

When a url points to a directory the css loader fails since it doesn't know how to substitute it. This is weird but the guys at leaflet are using this in order to resolve paths with css. Would it be possible to simply leave the paths that the loader can't find untouched? At least a warning saying so?

Please see https://github.com/Leaflet/Leaflet/issues/4849 to see what the css contains and why it breaks the css loader. At the moment I can't make a leaflet bundle with their latest code due to this issue.

Most helpful comment

anything new on this?
with leaflet-1.0.0 released today this will affect everyone using webpack and trying to update to latest leaflet

All 6 comments

It would be great if css-loader didn't fail hard here (especially as Leaflet have decided not to fix this issue). Due to this, we are unable to build any of our JS bundles without downgrading to Leaflet 1.0 RC1.

After over an hour of trying to get webpack to ignore this correctly I gave up and just disabled url() resolution in css-loader.

I thought I'd solved it with webpack.IgnorePlugin, but I didn't realize that css-loader would still break even if the webpack build finished without errors after ignoring the images/ import.

sigh

anything new on this?
with leaflet-1.0.0 released today this will affect everyone using webpack and trying to update to latest leaflet

Even if css-loader didn't error out, it wouldn't copy all of the images anyway since they're not referenced in the css. I'm not really sure how or why leaflet set up the their css this way, but you'll either need to copy the images folder yourself or reference a CDN, I believe.

This definitely seems like a problem with leaflet's implementation, disappointing that they've considered it wontfix.

Edit: I suppose I should have checked the upstream issue before saying that, looks like they'll accept PRs to fix it. Looks like the suggested fix would include a reference to one of the missing images, but unless the other two are referenced as well it looks like it will still be a problem.

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

Was this page helpful?
0 / 5 - 0 ratings